dimanche 29 janvier 2017

How to access data of one function to another in laravel

Okay the issue is something like this

I have a function in AController

public function index()
{
    $store = Store::(query)(to)(rows)->first();

    return view('store.index', compact('store'));
}

Now in the same controller I have another function

public function abc()
{
    return view('store.abc');
}

Now to this function I also want to send the compact('store') to the view abc I can just add the query again in the abc() function but that would be lazy and make performance issues. Is there a way that I can access $store object in other functions too?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2k6AQzA
via IFTTT

Aucun commentaire:

Enregistrer un commentaire