我正在尝试在Sentry
包中使用Eloquent模型(这可能是任何包)。
我在顶部使用use App\Models\User;
,在我需要调用它时使用User::
来引用它。
但是,我收到此错误:Class 'App\Models\User' not found
我做错了什么?
目前的代码在这里:http://paste.laravel.com/H19
答案 0 :(得分:0)
我假设您的模型位于应用程序的应用程序部分中。 在laravel中,App命名空间是顶级命名空间(默认命名空间)。
因此,要调用模型,您必须调用\ User(因为\引用顶级命名空间)
或者你可以这样做:
use \User as User
然后您可以将其称为用户而不是\用户