I have searched and found various results like these: auth()->user() is null in Laravel 5.2 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?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire