it is my article model
function tags()
{
return $this->belongsToMany('App\Tag')->withTimestamps();
}
it is my article model
function articles()
{
return $this->belongsToMany('App\Article');
}
it is my article controllers store method
public function store(ArticleRequest $request,
Article $article)
{
$article=Auth::user()->articles()->create($request->all());
$article->tags()->attach($request->input('tags'));
return redirect('articles');
}
i had this error
BadMethodCallException in Builder.php line 2071: Call to undefined method Illuminate\Database\Query\Builder::tags()
help me resolve this``
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire