I have user and post models have this relation:
// BlogPost
public function author() {
return $this->belongsTo('App\User');
}
// User
public function articles() {
return $this->hasMany('App\BlogPost');
}
In database I have "blog_posts" table with "author_id" field, but Laravel returns this error:
"Column not found: 1054 Unknown column 'user_id' in 'field list'".
What can I do?!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire