Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Class 'App\Http\Controllers\Redirect' not found

when i run below command in my terminal it shows below code instead of routes

php artisan route:list



 <html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="1;url=http://localhost/login" />

        <title>Redirecting to http://localhost/login</title>
    </head>
    <body>
        Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
    </body>
</html>

[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class 'App\Http\Controllers\Redirect' not found

like image 988
Milan Suthar Avatar asked Oct 06 '16 09:10

Milan Suthar


2 Answers

The only thing that you have to do is to add:

use Redirect;

in your controller just after namespace line or put \ before you call Redirect:: i.e.:

return \Redirect::back();
like image 128
Filip Koblański Avatar answered Oct 10 '22 11:10

Filip Koblański


You have to import the class. This is the one you need:

use Illuminate\Support\Facades\Redirect;
like image 25
Gauravbhai Daxini Avatar answered Oct 10 '22 12:10

Gauravbhai Daxini