Files
alrahma_sunday_school_api/app/Http/Resources/Roles/RoleResource.php
T
2026-03-10 17:11:48 -04:00

25 lines
994 B
PHP

<?php
namespace App\Http\Resources\Roles;
use Illuminate\Http\Resources\Json\JsonResource;
class RoleResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this->id ?? $this['id'] ?? 0),
'name' => (string) ($this->name ?? $this['name'] ?? ''),
'slug' => (string) ($this->slug ?? $this['slug'] ?? ''),
'description' => $this->description ?? $this['description'] ?? null,
'dashboard_route' => (string) ($this->dashboard_route ?? $this['dashboard_route'] ?? ''),
'priority' => (int) ($this->priority ?? $this['priority'] ?? 0),
'is_active' => (int) ($this->is_active ?? $this['is_active'] ?? 0),
'user_count' => $this->user_count ?? $this['user_count'] ?? null,
'created_at' => $this->created_at ?? $this['created_at'] ?? null,
'updated_at' => $this->updated_at ?? $this['updated_at'] ?? null,
];
}
}