[英]Symfony\Component\Debug\Exception\FatalThrowableError Class '\App\Admin' not found
I am using laravel-5.7. 我正在使用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. 您的
app
目录中没有名为Admin
的类,或者在类顶部没有namespace
。
<?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. 假设您在App文件夹中有一个名为Admin的Model类,然后在控制器中的某个位置调用它。
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
所以先检查两个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.