lundi 28 mai 2018

Laravel 5 want to access auth user id in model

I want to access the currently logged In user ID in the model. So in the model, I have written the codes;

namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Auth;

and in the method under the model, I used this code: Auth::user()->id However, I receives the error:

Trying to get property of non-object



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

Aucun commentaire:

Enregistrer un commentaire