Is it possible to set a resource route to root?
Like:
Route::resource('/', 'HomeController');
So I could use these urls:
/
/create
/214
/214/edit
I've tried, create , index works, route('store') recognized, but doesn't call store the function and redirects to home.
Not sure if you still need help with this one, since it's been more than a year. Try putting this in your blade file.
<form action="{{ route('store') }}" method="POST">
I've had a similar problem with my code. My original form had this, at the very beginning (using default documentation code here):
<form action="{{ route('photo.store') }}>
which, after trying it out, didn't work as I would expect - nothing was being stored. After making sure that the rest of the code was OK, one of my colleagues suggested that I type in the method type, since the default method is GET , and you need the POST method for storing .
All you need to do is Route::resource('/', 'HomeController');
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.