While you are working with laravel web applications and you may face Class ‘App\Http\Controllers\’ \Redirect, \Auth, \Session \Input, \Response, \Model, \View, \DB Not Found in Laravel 10, 9, 8, and 7.
So, in this tutorial you will learn how to fix Class ‘App\Http\Controllers\’ \Redirect, \Auth, \Session \Input, \Response, \Model, \View, \DB Not Found errors in Laravel 10, 9, 8, and 7.
Class ‘app\http\controllers\Redirect, \Auth, \Session \Input, \Response, \Model, \View, \DB Not Found
Here are solutions of Class ‘App\Http\Controllers\’ \Redirect, \Auth, \Session \Input, \Response, \Model, \View, \DB Not Found in Laravel 10, 9, 8, and 7:
- 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\Auth’ 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: Class ‘App\Http\Controllers\Redirect’ not found
If you are getting error like Class ‘App\Http\Controllers\Redirect’ not found on controller in laravel.
So, add use Redirect;
at the top of YourController
file along with other prefix:
On YourController.php file, add use Redirect;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Redirect;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
2: Class ‘App\Http\Controllers\Validator’ not found
If you are getting error like Class ‘App\Http\Controllers\Validator’ not found on controller in laravel.
So, add use Validator;
at the top of YourController
file:
On YourController.php file, add use Validator;
at the top of YourController
file like the following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
3: Class ‘App\Http\Controllers\Session’ not found
If you are getting error like Class ‘App\Http\Controllers\Session’ not found on controller in laravel.
So, add use Session;
at the top of YourController
file along with other prefix:
use Session;
OR
use Illuminate\Support\Facades\Session;
On YourController.php file, add use Session;
at the top of YourController
a file like the following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Session;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
4: Class ‘App\Http\Controllers\Auth’ not found
If you are getting error like Class ‘App\Http\Controllers\Auth’ not found on controller in laravel.
So, add use Auth;
at the top of YourController
file along with other prefix:
use Auth;
OR
Illuminate\Support\Facades\Auth;
On YourController.php file, add use Auth;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
5: Class ‘App\Http\Controllers\Input’ not found
If you are getting error like Class ‘App\Http\Controllers\Input’ not found on controller in laravel.
So, add use Illuminate\Support\Facades\Input;
at the top of YourController
file along with other prefix:
use Illuminate\Support\Facades\Input;
On YourController.php file, add use Illuminate\Support\Facades\Input;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
6: Class ‘App\Http\Controllers\Response’ not found
If you are getting error like Class ‘App\Http\Controllers\Response’ not found on controller in laravel.
So, add use Response;
at the top of YourController
file along with other prefix:
On YourController.php file, add use Response;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Response;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
7: Class ‘App\Http\Controllers\Model’ not found
If you are getting error like Class ‘App\Http\Controllers\Model’ not found on controller in laravel.
So, add use App\Model;
at the top of YourController
file along with other prefix:
On YourController.php file, add use Illuminate\Support\Facades\Input;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\ModelName;
class YourController extends Controller
{
public function index(Request $request)
{
//your code
}
}
8: Class ‘App\Http\Controllers\View’ not found
If you are getting error like Class ‘App\Http\Controllers\View’ not found on controller in laravel.
So, add use View;
at the top of YourController
file along with other prefix:
On YourController.php file, add use View;
at the top of YourController
file like following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use View;
class YourController extends Controller
{
public function index(Request $request)
{
return \View::make('index');
}
}
9: Class ‘App\Http\Controllers\DB’ not found
If you are getting error like Class ‘App\Http\Controllers\DB’ not found on controller in laravel.
So, add use DB;
at the top of YourController
file along with other prefix:
On YourController.php file, add use DB;
at the top of YourController file like the following:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
class YourController extends Controller
{
public function index(Request $request)
{
}
}