我可以通过迁移在数据库中创建第一条记录吗,其中password列中的第一条记录已经被加密
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->string('level');
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
User::firstOrCreate([
'name' => 'admin',
'email' => 'admin@app.com',
'level' => 'Administrator',
'password' => 'password'
]);
}
Run Code Online (Sandbox Code Playgroud)
代码可以工作,但未password加密,有什么建议吗?