Files
services_core/app/Http/Resources/MenuGroup/MenuGroupResource.php
T
2026-07-27 16:24:09 +07:00

32 lines
946 B
PHP

<?php
namespace App\Http\Resources\MenuGroup;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class MenuGroupResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'tenant_id' => $this->tenant_id,
'name' => $this->name,
'description' => $this->description,
'is_system' => (bool) $this->is_system,
'is_active' => (bool) $this->is_active,
'tenant' => $this->whenLoaded('tenant', fn () => $this->tenant ? [
'id' => $this->tenant->id,
'tenant_code' => $this->tenant->tenant_code,
'tenant_name' => $this->tenant->tenant_name,
] : null),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}