vendredi 21 juillet 2017

Trying to get property of non-object Laravel 5.4

Im trying to get values from foreign table.



This is my user model:

public function stat()
{
   $this->hasMany('App\Stat', 'user_id');
}

This is my stat model:

public function user()
{
    $this->belongsTo('App\User', 'id');
}

Im getting this error:

Trying to get property of non-object

Can someone help ?

All values exists in DB



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire