argument('email'); $roleName = $this->argument('role'); $branchCode = $this->option('branch'); $user = User::where('email', $email)->first(); if (!$user) { $this->error("User with email {$email} not found."); return Command::FAILURE; } $role = Role::where('name', $roleName)->first(); if (!$role) { $this->error("Role {$roleName} not found."); return Command::FAILURE; } // Assign role to user $user->assignRole($role, $branchCode); $this->info("Role '{$role->display_name}' assigned to user '{$user->name}'" . ($branchCode ? " for branch '{$branchCode}'" : '') . "."); return Command::SUCCESS; } }