forked from admin/services_core
32 lines
946 B
PHP
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,
|
|
];
|
|
}
|
|
}
|