Laravel - Call to undefined method Illuminate\Database\Query\Builder::user() Laravel - Call to undefined method Illuminate\Database\Query\Builder::user() laravel laravel

Laravel - Call to undefined method Illuminate\Database\Query\Builder::user()


Your note model is lacking the relationship definition for it's associated user, it looks like.

You should just be able to add the relationship in the Notes model like this:

public function user(){    return $this->belongsTo(User::class);}


That video does have some problems, so I also encountered the same problem.You should just be able to add the relationship in the Note model like this:

public function user(){    //return $this->belongsTo(User::class);    return $this->belongsTo('App\User');}

and in the User model like this:

public function notes(){    return $this->hasMany(Note::class);    //return $this->belongsTo('App\Note');}

bless you !