无法发布到 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: 31
message: "Class 'APP\User' not found"
trace: [{function: "store", class: "App\Http\Controllers\API\UserController", type: "->"},…]
这是我现在的文件:
用户.php
<?php
namespace 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。我确信很多事情都发生了变化,所以如果有人可以为此提供一些帮助,我肯定会很感激。先感谢您。
一只萌萌小番薯