0
votes

I've created one controller with web route. If I put a request in browser I am getting my output, but when I tried to debug I am getting a following error in debug console:

PHP Fatal error: Uncaught Error: Class 'Illuminate\Support\Facades\Route' not found in /home/payarc/Desktop/myDummy/routes/web.php:21
Stack trace:
#0 {main}
thrown in /home/payarc/Desktop/myDummy/routes/web.php on line 21

How to resolve this error?

web.php

<?php

use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

Route::get('/div',[UserController::class,'dummy']);

UserController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UserController extends Controller
{
    public function dummy(){
        $a=5;
        $b=0;
        $c=$a+$b;
        echo $c;
    }
}
1
Does vendor/laravel/framework/src/Illuminate/Support/Facades/Route.php exist? - aynber
@aynber, yeah it's present - Sravani
Try composer dumpautoload to see if that will help - aynber
Illuminate\Foundation\ComposerScripts::postAutoloadDump Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-dump event terminated with an exception . i am getting this error when i run composer dumpautoload - Sravani
You need to update your version of PHP, then, to at least 7.3.0. The project did not install correctly because your version of PHP is too low - aynber

1 Answers

0
votes

In your project check app.php file, you should keep the below line on the 'aliases' array:

'Route'     => "Illuminate\Support\Facades\Route",