fix: 修正 AdminUserSeeder 欄位結構與資料庫一致
All checks were successful
Star-Cloud-Deploy-System / deploy-demo (push) Successful in 44s
Star-Cloud-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-12 13:08:00 +08:00
parent 7db3ee3a05
commit d3684385b2

View File

@@ -4,6 +4,7 @@ namespace Database\Seeders;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
/** /**
* 管理員帳號 Seeder * 管理員帳號 Seeder
@@ -21,7 +22,13 @@ class AdminUserSeeder extends Seeder
$admin = User::where('username', 'admin')->first(); $admin = User::where('username', 'admin')->first();
if ($admin) { if ($admin) {
$this->command->info('Admin 帳號已存在,跳過建立。'); $this->command->info('Admin 帳號已存在,執行更新密碼與資料。');
$admin->update([
'name' => 'Admin',
'email' => 'admin@star-cloud.com',
'password' => Hash::make('password'),
'role' => 'admin',
]);
return; return;
} }
@@ -29,7 +36,7 @@ class AdminUserSeeder extends Seeder
'username' => 'admin', 'username' => 'admin',
'name' => 'Admin', 'name' => 'Admin',
'email' => 'admin@star-cloud.com', 'email' => 'admin@star-cloud.com',
'password' => bcrypt('password'), 'password' => Hash::make('password'),
'role' => 'admin', 'role' => 'admin',
]); ]);