Support the ongoing development of Laravel.io →
posted 10 years ago
Forms
Last updated 2 years ago.
0

Try this:

Route::get('edit-workout-category/{id}', ['as' => 'edit-workout-category',  'uses' => 'WorkoutCategoryController@edit']);
Last updated 2 years ago.
0

pogachar said:

Try this:

Route::get('edit-workout-category/{id}', ['as' => 'edit-workout-category',  'uses' => 'WorkoutCategoryController@edit']);

No :( same error.

Last updated 2 years ago.
0

Remove the "/" from form model. If you want to use routes you have to name them with 'as' => 'something'. Yours is named /edit-workout-category. Sorry I haven't spotted that one before.

Last updated 2 years ago.
0

Now you need to change also Form::model() - removing the / as user pogachar said

{{ Form::model($WorkoutCategory, array('route' => array('edit-workout-category', $WorkoutCategory->id), 'id' => 'add_workout_category_form', 'class' => 'form-horizontal', 'role'=>'form')) }}

or common conception in naming the routes is

Route::get('edit-workout-category/{id}', ['as' => 'category.workout.edit,  'uses' => 'WorkoutCategoryController@edit']);

and the Form::model would be

{{ Form::model($WorkoutCategory, ['route' => ['category.wrokout.edit', $WorkoutCategory->id], 'id' => 'add_workout_category_form', 'class' => 'form-horizontal', 'role'=>'form']) }}
Last updated 2 years ago.
0

Thanks guys it is working:


{{ Form::model($WorkoutCategory, array('route' => array('edit-workout-category', $WorkoutCategory->id), 'id' => 'add_workout_category_form', 'class' => 'form-horizontal', 'role'=>'form')) }}	


Route::get('edit-workout-category/{id}', ['as' => 'edit-workout-category',  'uses' => 'WorkoutCategoryController@edit']);

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.