lundi 28 mai 2018

Laravel 5 Unable to access currently logged in user id from custom helper

In AppServiceProvider, I called a function from a custom helper as follows:

public function boot()
    {
        View::share('tree', customhelper::generateSiteTree(0));
    }

The custom helper file is calling the database function as below:

$children = UserPermission::getLeftNavByUserId($startAt); 

In the custom helper function, I want to pass the current logged in user ID however, dd(Auth::user()) is returning null.

How can I pass the Auth::user()->id with the method

getLeftNavByUserId($startAt, Auth::user()->id);



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

Aucun commentaire:

Enregistrer un commentaire