Skip to content
Advertisement

Laravel: CRUD route has a empty parameter

I’m having a problem with a CRUD route. On my method edit in my controller UserGroupsController, the parameter $userGroup is empty.

UserGroupsController

JavaScript

edit.blade.php

JavaScript

form.blade.php

JavaScript

Routes:

JavaScript

php artisan route:list :

JavaScript

dd($userGroup):

JavaScript

In the file edit.blade.php, I print the variable $userGroup, but returns “[ ]”. And I have the same code to UsersControllers, but there works.

When I submit the form, I got this error:

JavaScript

Sorry for the english, I hope that you understand my problem and I can give more information. thanks

Advertisement

Answer

An edit method usually gets an id. To fix your problem, remove the type from the header and get the model in your method:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement