mercredi 3 février 2016

Auth::user() returns null in Laravel 5.2

I have searched and found various results like these: auth()->user() is null in Laravel 5.2 and Auth::user() returns null

But, mine still is not working.

Auth:user() works in the controller. but not in the Model, returns null.

the code is:

 public function scopeOwned($query){
        $query->where('user_id', '=' , Auth::user()->id);
    }

I tried dd(Auth::user()) as well. it returns null.

Any Idea?



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

Aucun commentaire:

Enregistrer un commentaire