Table 用户不存在 laravel 8

Table users doesnt exist laravel 8

我已经部署了我的 laravel 项目,但我不知道我的用户 table 不存在

用户模型

class User extends Authenticatable{
use HasFactory, Notifiable;

public function team(){
    return $this->belongsTo(Team::class);
}
public function ketua(){
    return $this->hesOne(Team::class);
}
public function requestjoin(){
    return $this->hasMany(Requestjoin::class);
}

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'role',
    'name',
    'email',
    'kontak',
    'password',
    'npm',
    'program_studi',
    'fakultas'
];

/**
 * 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',
];}

控制器存储

<?php

namespace App\Http\Controllers;

use stdClass;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use RealRashid\SweetAlert\Facades\Alert;
use App\Http\Requests\RegistrationRequest;
use App\Models\Mhsw;

class RegisterController extends Controller
{
    public function index()
    {
        return view('auth.register');
    }

    public function store(RegistrationRequest $request)
    {
        $attributes = $request->all();

        $attributes['password'] = Hash::make($request->password);
        
        $user = new User;
        $user->name = $attributes['name'];
        $user->email = $attributes['email'];
        $user->kontak = $attributes['kontak'];
        $user->npm = $attributes['npm'];
        $user->program_studi = $attributes['program_studi'];
        $user->fakultas = $attributes['fakultas'];
        $user->password = $attributes['password'];
        $user->save();
        


        Alert::success('Berhasil daftar', 'Silahkan login');

        return redirect('/login');
    }
}

存储方式

 public function store(RegistrationRequest $request)
{
    $attributes = $request->all();

    $attributes['password'] = Hash::make($request->password);
    
    $user = new User;
    $user->name = $attributes['name'];
    $user->email = $attributes['email'];
    $user->kontak = $attributes['kontak'];
    $user->npm = $attributes['npm'];
    $user->program_studi = $attributes['program_studi'];
    $user->fakultas = $attributes['fakultas'];
    $user->password = $attributes['password'];
    $user->save();
    


    Alert::success('Berhasil daftar', 'Silahkan login');

    return redirect('/login');
}

用户迁移

Schema::create('users', function (Blueprint $table) {
        $table->id();
        $table->foreignId('team_id')->nullable();
        $table->string('name');
        $table->integer('role')->nullable()->default(null);
        $table->string('email')->unique();
        $table->string('kontak')->unique();
        $table->string('npm')->unique();
        $table->string('program_studi');
        $table->string('fakultas');
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });

环境数据库

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pkme1826_pkmtest

错误

phpmyadmin

public function store(RegistrationRequest $request)
{
    $attributes = $request->all();

    $attributes['password'] = Hash::make($request->password);
    $user = new User;
    $user->name = $attributes['nama'];
    $user->email = $attributes['email'];
    $user->kontak = $attributes['kontak'];
    $user->npm = $attributes['npm'];
    $user->program_studi = $attributes['program_studi'];
    $user->fakultas = $attributes['fakultas'];
    $user->password = $attributes['password'];

    User::create($attributes);
    


    Alert::success('Berhasil daftar', 'Silahkan login');

    return redirect('/login');
}

我正在尝试注册新用户并显示该错误,我不知道错误代码在哪里,我已使用路由迁移数据库并调用 artisan 但一直显示错误

我将注册请求与包含

的规则一起使用
unique:Users

应该

unique:users