亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel Vue api 給出內部 500 服務器錯誤 App\User not found

Laravel Vue api 給出內部 500 服務器錯誤 App\User not found

PHP
qq_笑_17 2023-09-22 16:19:08
無法發布到 phpmyadmin。在當地工作。總體而言,該站點路由良好。我嘗試將模型添加到 auth.php 文件中,并更改 user.php 中的命名空間以包含其他論壇以及 stackoverflow 中建議的模型。這不起作用。我在網絡選項卡中收到以下錯誤:{message: "Class 'APP\User' not found", exception: "Error",…}exception: "Error"file: "C:\laragon\www\crm\app\Http\Controllers\API\UserController.php"line: 31message: "Class 'APP\User' not found"trace: [{function: "store", class: "App\Http\Controllers\API\UserController", type: "->"},…]這是我現在的文件:用戶.php<?phpnamespace App;use Illuminate\Contracts\Auth\MustVerifyEmail;use Illuminate\Foundation\Auth\User as Authenticatable;use Illuminate\Notifications\Notifiable;class User extends Authenticatable{    use Notifiable;    /**     * The attributes that are mass assignable.     *     * @var array     */    protected $fillable = [        'name', 'email', 'password', 'bio', 'photo', 'type'    ];    /**     * The attributes that should be hidden for arrays.     *     * @var array     */    protected $hidden = [        'password', 'remember_token',    ];    /**     * The attributes that should be cast to native types.     *     * @var array     */    protected $casts = [        'email_verified_at' => 'datetime',    ];}auth.php 中的身份驗證提供者部分 'providers' => [        'users' => [            'driver' => 'eloquent',            'model' => App\User::class,        ],我正在使用 Laravel 學習 VueJs 的舊教程,但他們使用的是 Laravel 5.7,而我使用的是 Laravel 7。我確信很多事情都發生了變化,所以如果有人可以為此提供一些幫助,我肯定會很感激。先感謝您。
查看完整描述

1 回答

?
一只萌萌小番薯

TA貢獻1795條經驗 獲得超7個贊

您的導入UserController.php應該是use App\User;App需要小寫。



查看完整回答
反對 回復 2023-09-22
  • 1 回答
  • 0 關注
  • 121 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號