32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PublicBusinessOpportunityResource extends JsonResource
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'slug' => $this->public_slug,
|
|
'title' => $this->public_title,
|
|
'activity_code' => $this->activity_code,
|
|
'stage' => $this->stage,
|
|
'objective' => $this->objective,
|
|
'currency' => $this->currency,
|
|
'amount_min' => $this->amount_min,
|
|
'amount_max' => $this->amount_max,
|
|
'available_percentage' => $this->available_percentage,
|
|
'published_at' => $this->published_at,
|
|
'sector' => $this->whenLoaded('sector', fn () => $this->sector?->only(['name', 'slug'])),
|
|
'province' => $this->province,
|
|
'district' => $this->district,
|
|
'locality' => $this->locality,
|
|
];
|
|
}
|
|
}
|