Missing required parameters for route issue in laravel
As you are using dot (.)
operator in your resource route it will generating nested routes.
You need to change your route name with single name like cms-home or cms_home
Then you can simple use it as:
Route::resource('cms_home','CmsHomeController');
In your blade you can call it:
<a href="{{ route('cms-home.create') }}" class="nav-link">
Please have look at this referance
Volka Dimitrev
World around me changing rapidly and I'm always in a learning curve . And I love to be there.
Updated on June 05, 2022Comments
-
Volka Dimitrev almost 2 years
In my laravel based application I have following link in my
admin.blade.php
<ul class="nav nav-treeview"> <li class="nav-item"> <a href="{{ route('cms.home.create') }}" class="nav-link"> <i class="far fa-circle nav-icon"></i> <p>{{ __('Home Page') }}</p> </a> </li> </ul>
In my project I have another blade called,
create.blade.php
which is in the following pathviews/cms/home/create.blade.php
I have a controller called,
CmsHomeController.php
for that bladeIn CmsHomeController I have a method called create
public function create() { return view('cms.home.create'); }
Once the user clicks on the above mentioned link in the
admin.blade.php
, user should go to thecreate.blade.php
blade.And in my
web.php
I have registered my route as follows,Route::resource('cms.home','CmsHomeController');
But now the issue is,
When I click on that link in admin blade, I'm getting an error saying
Facade\Ignition\Exceptions\ViewException Missing required parameters for [Route: cms.home.create] [URI: cms/{cm}/home/create]. (View: C:\xampp\htdocs\mylaravelproject\resources\views\layouts\admin.blade.php)
In
create.blade.php
, I'm having just a simple formWhere am I doing wrong and what would be the correct fix?
UPDATE:
I tried running
php artisan route:list
This is what I got
I don't have such a param called, 'cm'..
-
Dipak Mewada about 4 yearsYou can check your route name with this command php artisan route:list and check name against the route.
-
Dipak Mewada about 4 yearshave a look at my answer i have just posted below!!
-
-
Volka Dimitrev about 4 yearsBut i'm not passing any params to my method and what is this 'cm'?
-
Arnaud about 4 yearsI don't know your entire application, i just read the error message Missing required parameters for [Route: cms.home.create] [URI: cms/{cm}/home/create]
-
Volka Dimitrev about 4 yearsWell, I don't really have a param or a variable called 'cm'
-
Volka Dimitrev about 4 yearsyes that seem to be the issue, changed my route to this, Route::get('/cms/home/create', 'CmsHomeController@index')->name('cms-home.create'); and it's working now. thanks for the guidance
-
Dipak Mewada about 4 years@VolkaDimitrev Great!! Glad to help you on your concern.