27 lines
636 B
PHP
27 lines
636 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Http\Resources;
|
||
|
|
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
|
||
|
|
class JobCategoryResource extends JsonResource
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Transform the resource into an array.
|
||
|
|
*
|
||
|
|
* @return array<string, mixed>
|
||
|
|
*/
|
||
|
|
public function toArray(Request $request): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'id' => $this->id,
|
||
|
|
'name' => $this->name,
|
||
|
|
'slug' => $this->slug,
|
||
|
|
'description' => $this->description,
|
||
|
|
'icon' => $this->icon,
|
||
|
|
'jobs_count' => $this->when(isset($this->jobs_count), $this->jobs_count),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|