0

I'm new to Laravel and try to run a program. In the source code, the route login.post already declared in web.php. however i still getting error Route [login.post] not defined.. Is there any missing configuration i missing? I already ran composer install and composer update. php artisan db:seed and php artisan migrate.

web,php

Route::get('login', [AuthController::class, 'index'])->name('login');
Route::post('post-login', [AuthController::class, 'postLogin'])->name('login.post'); 
Route::get('register', [AuthController::class, 'register'])->name('register');
Route::post('post-registration', [AuthController::class, 'postRegistration'])->name('register.post'); 
Route::get('logout', [AuthController::class, 'logout'])->name('logout');

Error picenter image description here

anggor
  • 79
  • 1
  • 10
  • Why do you think it should work? I mean you do assign a name to the route and the route() helper should work with the name, but [the Laravel documentation remains unspecific about the characters and from which character set a name must be and also any length constraints](https://laravel.com/docs/10.x/routing#named-routes). Therefore I'd say the behaviour you describe maybe either using the wrong name (e.g. just a typo or little mistake) or implementation specified by the Laravel version you're using. +[Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – hakre Sep 02 '23 at 09:53
  • You may need to clear your route cache: https://stackoverflow.com/questions/62979986/laravel-routing-cache - though you _might_ also want to avoid using `.` in your route names... I think they're okay, but not able to check that right now. – HorusKol Sep 02 '23 at 11:33
  • @HorusKol Dots in route names are and have been fine as long as I can remember. – D1__1 Sep 02 '23 at 12:01

1 Answers1

-1

Run php artisan optimize This clears the route cache

  • ``php artisan optimize`` does the opposite of what you're saying! It should be ``php artisan optimize:clear`` or ``php artisan route:clear`` to clear route caches or ``php artisan cache:clear`` to clear all caches. – OMi Shah Sep 02 '23 at 15:38