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

@@ -13,11 +13,8 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
$this->call([
UserSeeder::class,
]);
}
}

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}");
}
}