0
votes

My controllers which are HomeController and BlogController in Admin folder. My views like:

  • /admin
    • index.blade.php
    • /blog
      • index.blade.php

I want to call /admin0admin url to /resources/views/admin/index.blade.php.

I want to call /admin0admin/blog url to /resources/views/admin/blog/index.blade.php

Here how i call in view:

<a href="{{ route('admin0admin.blog') }}" class="br-menu-link">

And my routes like:

Route::group(['namespace' => 'Admin', 'prefix' => 'admin0admin'], function () {
     Route::get('/', 'HomeController@index')->name('index');

     Route::group(['prefix' => 'blog'], function () {
         Route::get('/', 'BlogController@index')->name('index');
     });
});

And my BlogController index method:

return view('admin.blog.index');

I got an 404 not found error.

Route [admin0admin.blog] not defined

Laravel Version is : 5.6.*

enter image description here

1
Check out php artisan route:list to find out what the names and routes are in your app. - Jeff
i added route list too - Nevermore
there is your issue! You need to name the route admin0admin.blog, not index. prefix does not affect names of routes, so you need to write it out. - Jeff
can you write as an answer? - Nevermore

1 Answers

1
votes

You need to name the route admin0admin.blog, not index. prefix does not affect names of routes, so you need to write it out.