2 months ago

Call to undefined method App\Article::tags() Error

Posted 2 months ago by sagar001

When i am passing data to this method i am getting "Call to undefined method App\Article::tags()". In my article model there is a method

protected function tags()
	return $this->belongsToMany(Tag::class);

and in my articleController i have this method

public function store(Request $request)
        $validatedAttribute = request()->validate([
            'title'     => 'required',
            'excerpt'   => 'required',
            'body'      => 'required'

        $article = new Article($validatedAttribute);
        $article->user_id = 1;


        return redirect('/article');

Anybody just tell me what i am doing wrong here.. Thanks :)

Please sign in or create an account to participate in this conversation.