Class 'app\http\controllers\Session, Auth, Model, DB Not Found

Laravel

203

Shubham Kushwah

14-08-2020


In this post, i will show you how to fix Class 'app\http\controllers\Auth Not Found, Class 'app\http\controllers\Session Not Found, Class 'app\http\controllers\DB Not Found , Class 'app\http\controllers\Model Not Found execption in laravel.

Let's start to fix the following execption in laravel.

  • Class 'app\http\controllers\Auth Not Found
  • Class 'app\http\controllers\Session Not Found
  • Class 'app\http\controllers\DB Not Found
  • Class 'app\http\controllers\Model Not Found

Class 'app\http\controllers\Auth Not Found

If you found Class 'app\http\controllers\Auth Not Found, so open your controller and add following facade into your controller file in laravel:

use Illuminate\Facades\Auth ;

OR

use Auth;

Add this auth facade into controller as follow:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Auth;

class TestController extends Controller
{
    //your code
}

Class 'app\http\controllers\Session Not Found

If you found Class 'app\http\controllers\Session Not Found, so open your controller and add following facade into your controller file in laravel:

use Illuminate\Facades\Session;

OR

use Session;

Add this Session facade into controller as follow:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Session;

class TestController extends Controller
{
    //your code
}
 

Class 'app\http\controllers\DB Not Found

If you found Class 'app\http\controllers\DB Not Found, so open your controller and add following facade into your controller file in laravel:

use DB;

Add this DB facade into controller as follow:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;

class TestController extends Controller
{
    //your code
}

Class 'app\http\controllers\Model Not Found

If you found Class 'app\http\controllers\Model Not Found, so open your controller and add following facade into your controller file in laravel:

use App\ModelName;

Add this Model facade into controller as follow:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User; //model name

class TestController extends Controller
{
    //your code
}