Reputation: 77
I have folder "aboutus" which contains 'index.blade.php' file and folder "thanks". Folder "thanks"contains also 'index.blade.php'
My route for both of them:
Route::resource('admin/aboutus', 'AdminAboutusController',['names'=>[
'index'=>'admin.aboutus.index',
'create'=>'admin.aboutus.create',
'store'=>'admin.aboutus.store',
'edit'=>'admin.aboutus.edit'
]]);
Route::resource('admin/aboutus/thanks', 'AboutThanksController',['names'=>[
'index'=>'admin.aboutus.thanks.index',
'create'=>'admin.aboutus.thanks.create',
'store'=>'admin.aboutus.thanks.store',
'edit'=>'admin.aboutus.thanks.edit'
]]);
I have created controller for aboutus and thanks separately (AdminAboutusController and AboutThanksController)
AdminAboutusController index funnction returns view which i am able to see
public function index() { return view('admin.aboutus.index'); }
But controller AboutThanksController doesn`t shows me my page, it shows me white blank
public function index() { return view('admin.aboutus.thanks.index'); }
on php artisan route:list i can see that route is aviable. Why it happens and how can I fix it?
Upvotes: 0
Views: 84
Reputation: 2453
Put thanks
route above about us
route
Route::resource('admin/aboutus/thanks', 'AboutThanksController',['names'=>[
'index'=>'admin.aboutus.thanks.index',
'create'=>'admin.aboutus.thanks.create',
'store'=>'admin.aboutus.thanks.store',
'edit'=>'admin.aboutus.thanks.edit'
]]);
Route::resource('admin/aboutus', 'AdminAboutusController',['names'=>[
'index'=>'admin.aboutus.index',
'create'=>'admin.aboutus.create',
'store'=>'admin.aboutus.store',
'edit'=>'admin.aboutus.edit'
]]);
Upvotes: 1
Reputation: 653
using route:list
you are able to see list of routes but return view()
function don't take route as a parameter. You have to give the file name and path.For example you want to show thanks.blade.php
file which is inside admin/aboutus of your view folder. So you have to write:
return view('admin.aboutus.thanks');
Upvotes: 0
Reputation: 9045
Posting as an answer to close the question:
You have admin.aboutus.thnx.index
but your folder is admin/aboutus/thanks/index
Please change to admin.aboutus.thanks.index
and it should work
Upvotes: 0