Admin Workflow - API code refactor to fetch booking information

This commit is contained in:
Dillon Ngo
2025-01-03 19:40:00 +08:00
parent 44b7c7294b
commit abe1f3df2b
7 changed files with 228 additions and 79 deletions
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class BookingBaseResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function toArray($request)
{
return [
'id' => $this->id,
'company' => new CompanyResource($this->company),
'bank' => new BankResource($this->bank),
'marking' => $this->marking,
];
}
}