Laravel - Error Class ‘app\http\controllers\Redirect, Auth, Session Not Found

Mar 19, 2022 . Admin

Hi dev,

Today, I am explain Class ‘app\http\controllers\Redirect, Auth, Session Not Found. We will look at an example of all class not found example. This tutorial will give you a simple example of class not found error solved.

You can use this Class ‘app\http\controllers\Redirect’ not found solutions with Laravel 6, Laravel 7, Laravel 8 and Laravel 9 versions on Controller.

So let's start following example:

Class ‘app\http\controllers\ Not Found

In this tutorial, we will provide you solutions of the following exceptions:

Class ‘App\Http\Controllers\Redirect’ not found

Class ‘App\Http\Controllers\Validator’ not found

Class ‘App\Http\Controllers\Session’ not found

Class ‘App\Http\Controllers\Input’ not found

Class ‘App\Http\Controllers\Response’ not found

Class ‘App\Http\Controllers\Model’ not found

Class ‘App\Http\Controllers\View’ not found

Class ‘App\Http\Controllers\DB’ not found

1: Laravel - Class ‘App\Http\Controllers\Redirect’ not found

So Error getting like Class ‘App\Http\Controllers\Redirect’ not found on controller in laravel.

add use Redirect; at the top of UserController file along with other prefix:

use Redirect;
On UserController.php file, add use Redirect; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Redirect;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
2: Laravel - Class ‘App\Http\Controllers\Validator’ not found

So Error getting like Class ‘App\Http\Controllers\Validator’ not found on controller in laravel.

add use Validator; at the top of UserController file:

use Validator;
On UserController.php file, add use Validator; at the top of UserController file like the following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Validator;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
3: Laravel - Class ‘App\Http\Controllers\Session’ not found

So Error getting like Class ‘App\Http\Controllers\Session’ not found on controller in laravel.

add use Session; at the top of UserController file along with other prefix:

use Session;
 
OR
 
use Illuminate\Support\Facades\Session;
On UserController.php file, add use Session; at the top of UserController a file like the following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Session;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
4: Laravel - Class ‘App\Http\Controllers\Auth’ not found

So Error getting like Class ‘App\Http\Controllers\Auth’ not found on controller in laravel.

add use Auth; at the top of UserController file along with other prefix:

use Auth;
 
OR
 
Illuminate\Support\Facades\Auth;
On UserController.php file, add use Auth; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Auth;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
5: Laravel - Class ‘App\Http\Controllers\Input’ not found

So Error getting like Class ‘App\Http\Controllers\Input’ not found on controller in laravel.

add use Illuminate\Support\Facades\Input; at the top of UserController file along with other prefix:

use Illuminate\Support\Facades\Input;
On UserController.php file, add use Illuminate\Support\Facades\Input; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Illuminate\Support\Facades\Input;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
6: Laravel - Class ‘App\Http\Controllers\Response’ not found

So Error getting like Class ‘App\Http\Controllers\Response’ not found on controller in laravel.

add use Response; at the top of UserController file along with other prefix:

use Response;
On UserController.php file, add use Response; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Response;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
7: Laravel - Class ‘App\Http\Controllers\Model’ not found

So Error getting like Class ‘App\Http\Controllers\Model’ not found on controller in laravel.

add use App\Model; at the top of UserController file along with other prefix:

use App\ModelName;
On UserController.php file, add use Illuminate\Support\Facades\Input; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use App\ModelName;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}
8: Laravel - Class ‘App\Http\Controllers\View’ not found

So Error getting like Class ‘App\Http\Controllers\View’ not found on controller in laravel.

add use View; at the top of UserController file along with other prefix:

use View;
On UserController.php file, add use View; at the top of UserController file like following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use View;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        return \View::make('index');
    }
 
}
9: Laravel - Class ‘App\Http\Controllers\DB’ not found

So Error getting like Class ‘App\Http\Controllers\DB’ not found on controller in laravel.

add use DB; at the top of UserController file along with other prefix:

use DB;
On UserController.php file, add use DB; at the top of UserController file like the following:
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use DB;
 
class UserController extends Controller
{
    public function index(Request $request)
    {
        
    }
 
}
I hope it can help you...
#Laravel