mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-21 13:34:08 +00:00
update replica packages logic and over weight price announcement
This commit is contained in:
@@ -16,8 +16,9 @@ class PackingListResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$replica = $this->packingLists->first();
|
||||
$exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]);
|
||||
$packages = !$this->packingLists()->exists() || $exceptionUsers ? $this->packages : $this->packingLists->first()->packages;
|
||||
$packages = !$replica || $exceptionUsers ? $this->packages : $replica->packages;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
@@ -27,7 +28,7 @@ class PackingListResource extends JsonResource
|
||||
'transport' => new TransportResource($this->transports()->first()),
|
||||
'type' => $this->type,
|
||||
'packages' => PackageResource::collection($packages),
|
||||
'packing_list' => new PackingListResource($this->packingLists->first()),
|
||||
'packing_list' => new PackingListResource($replica),
|
||||
$this->mergeWhen($this->owner instanceof Order, [
|
||||
'order' => New OrderResource($this->owner)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user