customerPermissions as $permissionName) { Permission::updateOrCreate([ 'name' => $permissionName, 'guard_name' => 'customer', ]); } /** ---------------------------------------------------------------- * 2) Create Customer Role * ----------------------------------------------------------------*/ $customerRole = Role::updateOrCreate([ 'name' => 'Customer', 'guard_name' => 'customer', 'restaurant_id' => null, ]); $customerRole->syncPermissions($this->customerPermissions); /** ---------------------------------------------------------------- * 3) Walk-in Customer * ----------------------------------------------------------------*/ Customer::updateOrCreate([ 'customer_code' => 'CUST-WALKIN', ], [ 'restaurant_id' => 1, 'name' => 'Walk-in', 'phone' => '00123456789', 'address' => 'Counter', 'status' => 1, ]); /** ---------------------------------------------------------------- * 4) Demo Customers * ----------------------------------------------------------------*/ for ($i = 1; $i <= 10; $i++) { $customer = Customer::updateOrCreate( ['email' => "customer{$i}@example.com"], [ 'restaurant_id' => 1, 'customer_code' => 'CUST-'.strtoupper(Str::random(6)), 'name' => "Customer {$i}", 'email_verified_at' => now(), 'phone' => "013000000{$i}", 'password' => Hash::make('password123'), 'platform' => 'WEB', 'address' => 'Dhaka, Bangladesh', 'status' => 1, ] ); // Assign role safely $customer->assignRole($customerRole); // ✅ pass name only } $this->command->info('✅ Seeded 1 Walk-in + 10 demo customers successfully.'); /** ---------------------------------------------------------------- * 5) OAuth Clients for Users and Customers * ----------------------------------------------------------------*/ $this->createOAuthClient('users', 'User Personal Access Client'); $this->createOAuthClient('customers', 'Customer Personal Access Client'); // 6) Booking Module Seeders $this->call([ BookingTableSeeder::class, ]); } private function createOAuthClient(string $provider, string $name): void { $clientId = (string) Str::uuid(); $clientSecret = Str::random(40); DB::table('oauth_clients')->updateOrInsert( ['provider' => $provider], [ 'id' => $clientId, 'owner_type' => null, 'owner_id' => null, 'name' => $name, 'secret' => Hash::make($clientSecret), 'provider' => $provider, 'redirect_uris' => '[]', 'grant_types' => '["personal_access"]', 'revoked' => 0, 'created_at' => now(), 'updated_at' => now(), ] ); $this->command->info("🔐 OAuth $provider Client ID: $clientId"); $this->command->info("🔐 OAuth $provider Secret: $clientSecret"); } }