update deploy
This commit is contained in:
33
app/Http/Resources/MenuResource.php
Normal file
33
app/Http/Resources/MenuResource.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Menu;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Menu
|
||||
*/
|
||||
class MenuResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
'location' => $this->location?->value,
|
||||
'type' => $this->type?->value,
|
||||
'parent_id' => $this->parent_id,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'children' => self::collection($this->whenLoaded('children')),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user