mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-21 13:34:00 +00:00
32 lines
871 B
PHP
32 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PackageBaseResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$data = [
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'description' => $this->description,
|
|
'width' => floatval($this->width),
|
|
'height' => floatval($this->height),
|
|
'length' => floatval($this->length),
|
|
'weight' => $this->weight,
|
|
'quantity' => $this->quantity,
|
|
'cbm' => (($this->width / 100) * ($this->height / 100) * ($this->length / 100)) * $this->quantity,
|
|
'status' => $this->status,
|
|
];
|
|
return $data;
|
|
}
|
|
}
|