dsmI
168
26
Laravel

Multiple parameters to crud

Posted 1 year ago by dsmI

Hi, I'm having, probably a basic issue for some, problems with my edit crud.

I have this two routes in my web.php.

// Categories
Route::resource('docs', 'CategoryController');

// Articles
Route::resource('docs/{category}/', 'ArticleController');

The categories rout generates the url docs/category_name, by having it I can create categories in separate table.

The second route is for creating articles. I'd like to display it like docs/category_name/article_name.

But then I get the error "Missing required parameters for [Route: store] [URI: docs/{category}]"

This is my edit crud:


public function create($category)
{
    return view('articles.create')
    ->with('category', $category);
}

Still does it not work.

In my articles.edit file I have the following:

{!! Form::open(['route' => 'store']) !!}

I can't find where I'm wrong. Please provide me with some valuable information. Thank you!

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

Reply to

Use Markdown with GitHub-flavored code blocks.