mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-21 05:24:09 +00:00
34 lines
937 B
PHP
34 lines
937 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
use App\Models\Company;
|
|
use App\Models\Currency;
|
|
use App\Models\OrderStep;
|
|
use App\Models\SegmentConstant;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class OrderResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'reference' => $this->reference,
|
|
'reference_contract' => (int) $this->type,
|
|
'type' => (int) $this->type,
|
|
'status' => (int) $this->status,
|
|
'current_step' => $this->current_step,
|
|
'company' => new CompanyResource(Company::where('id',$this->companyModule()->first()->company_id)->first()),
|
|
'order_steps' => OrderStepsResource::collection($this->orderSteps()->get()),
|
|
];
|
|
}
|
|
}
|