21 lines
503 B
PHP
21 lines
503 B
PHP
<?php
|
|
|
|
namespace App\Domains\Forms\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class StaffFormResource extends JsonResource
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'categories' => $this->resource['categories']->map(fn ($category) => [
|
|
'id' => $category->id,
|
|
'nombre' => $category->nombre,
|
|
])->values(),
|
|
];
|
|
}
|
|
}
|