irankhosravi
4 months ago

Method App\Http\Requests\ProductRequest::categories does not exist.

Posted 4 months ago by irankhosravi

I am getting this error when trying to submit a save form using Request.

Method App\Http\Requests\ProductRequest::categories does not exist.

This is the code:

public function store(ProductRequest $request)
{
    $images = $this->uploadImages($request->file('images'));
    auth()->user()->products()->create(array_merge($request->all(), ['images' => $images]));
    $request->categories()->attach($request->name);
    return redirect(route('articles.index'));
}

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