Car-Repairs-Shop/app/Console/Commands/CheckUserRoles.php
sackey cbae4564b9
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
Add customer portal views for dashboard, estimates, invoices, vehicles, and work orders
- Implemented dashboard view with vehicle stats, active services, recent activity, and upcoming appointments.
- Created estimates view with filtering options and a list of service estimates.
- Developed invoices view to manage service invoices and payment history with filtering.
- Added vehicles view to display registered vehicles and their details.
- Built work orders view to track the progress of vehicle services with filtering and detailed information.
2025-08-08 09:56:26 +00:00

50 lines
1.6 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\User;
use Illuminate\Support\Facades\DB;
class CheckUserRoles extends Command
{
protected $signature = 'check:user-roles {email}';
protected $description = 'Check user roles and their status in detail';
public function handle()
{
$email = $this->argument('email');
$user = User::where('email', $email)->first();
if (!$user) {
$this->error("User with email {$email} not found");
return;
}
$this->info("User: {$user->name} (ID: {$user->id})");
$this->info("User Status: {$user->status}");
$this->info("isCustomer() result: " . ($user->isCustomer() ? 'true' : 'false'));
// Get detailed role information
$roles = DB::table('user_roles')
->join('roles', 'user_roles.role_id', '=', 'roles.id')
->where('user_roles.user_id', $user->id)
->select('roles.name', 'user_roles.is_active', 'user_roles.assigned_at', 'user_roles.expires_at')
->get();
$this->info("\nRole Details:");
if ($roles->isEmpty()) {
$this->info("No roles assigned");
} else {
foreach ($roles as $role) {
$this->info("Role: {$role->name}");
$this->info(" Active: " . ($role->is_active ? 'Yes' : 'No'));
$this->info(" Assigned: {$role->assigned_at}");
$this->info(" Expires: " . ($role->expires_at ?: 'Never'));
$this->info("");
}
}
}
}