Files
beatbook/database/seeders/DatabaseSeeder.php
T
2026-09-12 20:45:05 +01:00

29 lines
1.8 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\DjProfile;
use App\Models\Genre;
use App\Models\User;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class DatabaseSeeder extends Seeder
{
public function run(): void
{
foreach (['super-admin', 'admin', 'dj', 'client', 'moderator', 'support'] as $r) {
Role::firstOrCreate(['name' => $r, 'guard_name' => 'web']);
} $admin = User::firstOrCreate(['email' => 'admin@beatbook.test'], ['name' => 'BeatBook Admin', 'password' => 'password']);
$admin->assignRole('admin');
$djUser = User::firstOrCreate(['email' => 'dj@beatbook.test'], ['name' => 'Luna Hart', 'password' => 'password']);
$djUser->assignRole('dj');
User::firstOrCreate(['email' => 'client@beatbook.test'], ['name' => 'Demo Client', 'password' => 'password'])->assignRole('client');
$dj = DjProfile::firstOrCreate(['slug' => 'dj-luna'], ['user_id' => $djUser->id, 'stage_name' => 'DJ Luna', 'headline' => 'Weddings · House · Chart · Private events', 'bio' => 'Award-winning mobile DJ bringing polished production, packed dance floors and a personal soundtrack to weddings and events.', 'city' => 'London', 'price_from' => 350, 'profile_photo' => 'https://images.unsplash.com/photo-1516280440614-37939bbacd81?auto=format&fit=crop&w=900&q=85', 'cover_photo' => 'https://images.unsplash.com/photo-1571266028243-d220c9c3b2d2?auto=format&fit=crop&w=1800&q=85', 'verified_at' => now(), 'is_featured' => true, 'is_published' => true, 'average_rating' => 4.9, 'review_count' => 128]);
foreach (['House', 'Chart', 'Wedding', 'R&B'] as $g) {
$genre = Genre::firstOrCreate(['slug' => strtolower(str_replace('&', 'and', $g))], ['name' => $g]);
$dj->genres()->syncWithoutDetaching($genre);
}
}
}