The GET method is not supported for this route.Supported methods: HEAD

Viewed 365

I just installed Laravel 8 and created new controller and route. when i try to use new route that i created which is working fine but route('/') is not working. giving me error The GET method is not supported for this route. Supported methods: HEAD.

route/web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('login', [LoginController::class,'loginShow'])->name('login');

LoginController

class LoginController extends Controller
{
     function loginShow(){
        return view('Login.login');
     }
}

Route List enter image description here

Problem Detail : here i have 2 routes 1) mydomin or mydomin/ 2) myDomian/login

here myDomian/login is working as i want but when i try to use mydomin then i am getting enter image description here

many time i face thing problem but sometime i fix anyway. But i want to know its real reason why it happen? so next time i will take case self. here mydomin is GET method route and i delcleared in web.php as GET. so why it is telling it is HEAD not get? Also note that before create a new route it was working in same way. so why now not? please tell me reason of this.

1 Answers

i got my solution using php artisan serve . so after that it is start working. but i a could not understand why it is not working without php artisan serve .... if any one has any reason please tell us.

Related