I'm remaking the registration for my site, and have made a form that takes e-mail, password etc:
<form method="POST" class="etc" action="{{ route('register/blade/create') }}">
...
</form>
Then of course, my submit button in the form submits it and from routes in web.php:
Route::post('/register/basic/create', 'RegisterController@create');
However, every time I load this page, I get the following error:
I tried following others who had similar problems that posted on stack overflow, creating a named route, but that didn't seem to do the trick either. Any help is appreciated.
All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by your application's App\Providers\RouteServiceProvider . The routes/web.php file defines routes that are for your web interface.
You may use the current, currentRouteName, and currentRouteAction methods on the Route facade to access information about the route handling the incoming request: $route = Route::current(); $name = Route::currentRouteName(); $action = Route::currentRouteAction();
Route::domain (Used in Laravel 5.4)or Route::group(['domain' => 'xyz.com'])? are is used when you have a sub domain which can be either dynamic or statc for example. Copy Code. Route::domain('{account}. myapp.com')->group(function () { Route::get('user/{id}', function ($account, $id) { // }); });
When you use named route route
then you have to specify routes name in your routes/web.php
file. Like this
routes/web.php
Route::post('/register/basic/create', 'RegisterController@create')->name('register');
In blade file
<form method="POST" class="etc" action="{{ route('register') }}">
...
</form>
Check details here https://laravel.com/docs/5.6/routing#named-routes
Sometimes the above error occurs when you have two routes with the same uri but different callbacks and different route name
For example
Route::post('update','PermissionController@update')->name('update_permission');`
Route::post('update','RoleController@update')->name('update_role');
The above routes update different resources but it will still return an error Route update_permission
not defined or Route update_role
not defined.
So the best thing to do is to use a different uri in each route so as to prevent conflict like this
Route::post('/role_permission/update','RoleController@update')->name('update_role');`
Route::post('/permission/update','PermissionController@update')->name('update_permission');
There is a possibility that you cashed the route so clear route cashe
php artisan route:clear
if you still not finding your route After clearing cache, then remove the route and re-write your route with different keywords, hope you will find the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With