Fixed: Create admin

This commit is contained in:
iVampireSP.com 2022-08-16 14:50:18 +08:00
parent 17c816ac50
commit 00029f75d5
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 4 additions and 6 deletions

View File

@ -32,13 +32,11 @@ public static function boot()
parent::boot(); parent::boot();
self::creating(function ($admin) { self::creating(function ($admin) {
if (app()->environment('production')) { // if not set api_token
if (!$admin->api_token) {
$admin->api_token = Str::random(60); $admin->api_token = Str::random(60);
} else {
$admin->api_token = 123456;
} }
}); });
} }
} }

View File

@ -36,7 +36,7 @@ public function up()
$admin->name = 'admin'; $admin->name = 'admin';
$admin->email = 'admin@admin.test'; $admin->email = 'admin@admin.test';
$admin->password = bcrypt('admin'); $admin->password = bcrypt('admin');
$admin->api_token = 'Qwerty123'; $admin->api_token = 123456;
$admin->save(); $admin->save();
} }
} }