dsmI
18
26
Laravel

Multiple parameters to crud

Posted 9 months 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.