<?php

namespace App\Livewire\Roles;

use App\Domain\Identity\Models\Role;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Component;

#[Layout('layouts.app')]
#[Title('الأدوار والصلاحيات')]
class RoleList extends Component
{
    public function render()
    {
        $roles = Role::withCount('users')
            ->orderBy('level', 'desc')
            ->get();

        return view('livewire.roles.role-list', [
            'roles' => $roles,
        ]);
    }
}
