简体   繁体   中英

Symfony\Component\Debug\Exception\FatalThrowableError Class '\App\Admin' not found

I am using laravel-5.7. i am making multi auth system I'm getting the following error

Symfony\Component\Debug\Exception\FatalThrowableError Class '\App\Admin' not found

The answer is in the error that you get. You either don't have a class in your app directory named Admin or you don't have the namespace on top of your class.

<?php namespace App;

class Admin 
{

}

or if your error is in a different class then you need to import it on top.

...
use PATH_TO_THE_ADMIN;

class YourClass {}

Suppose you have Model class called Admin in the App folder, then you are calling it somewhere in the controller.

namespace App;

use Illuminate\Database\Eloquent\Model;

class Admin extends Model
{
    //
}

Your controller will be

<?php

namespace App\Http\Controllers;
use App\Admin;
use Illuminate\Http\Request;

class YourController extends Controller
{
   //Your code goes here
}

Most of the times when your class is not found, is basically as a result of not importing your namespace or typo error. so checke the two before anything else

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM