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

Viewed 13206

Hello i am new to laravel but i can't discover why i can't acess to my default path

My route:

      Route::get('/', 'HomeController@home');

My controller:

<?php

 namespace App\Http\Controllers;

 use Illuminate\Http\Request;

 class HomeController extends Controller
 {

 public function home()
 {
    return view('home.home');
 }
}

My route list enter image description here

I have try with diferent middlewares and also i have change this api.route i have delete this:

 //Route::middleware('auth:api')->get('/user', function (Request $request) {
  //  return $request->user();
  //});

Please help i am start going crazy.

7 Answers

Solved my same problem just with command:

php artisan route:clear

If you're facing this problem, simply run this command

php artisan optimize

The above command will clear all routes, files and configurations and also go ahead to create new cache for them.

It works for me

 php artisan optimize:clear
 php artisan route:clear

Try using the following commands:

php artisan cache:clear
php artisan route:cache  
php artisan config:cache  
php artisan view:clear

in my case i solve this issue with run : php artisan cache:clear command 4 times.

  • more usefull command :
  • php artisan cache:clear # for clear your application cache.
  • php artisan route:cache # for clear your application route cache.
  • php artisan config:cache # you should cache all of your configuration files into a single file
  • php artisan view:clear # if you want to clear view cache

in my case:

php artisan optimize
php artisan optimize:clear

solve the problem

the best way for solving this problem is to clear route cache through

php artisan route:clear 

I have tried many methods but did not get to the right solution however did not lose the heart and try php artisan route:clear

Related