This commit is contained in:
ct
2025-08-10 21:10:33 +08:00
parent 480bd9055d
commit 583a804073
43 changed files with 7623 additions and 270 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
class UserSeeder extends Seeder
{
public function run(): void
{
if (User::exists()) {
$this->command->error("Users already exist! This seeder can only be run once.");
return;
}
$user = User::create([
'name' => 'Crawlshot API User',
'email' => 'api@crawlshot.test',
'password' => bcrypt('password')
]);
$token = $user->createToken('crawlshot-api')->plainTextToken;
$this->command->info("User created: {$user->email}");
$this->command->info("API Token: {$token}");
$this->command->line("Use this token in Authorization header: Bearer {$token}");
}
}