46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Beike\Admin\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class LogisticsResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param Request $request
|
|
* @return array
|
|
* @throws \Exception
|
|
*/
|
|
public function toArray($request): array
|
|
{
|
|
|
|
$data = [
|
|
'id' => $this->id,
|
|
'name' => $this->name ?? '',
|
|
'warehouse_name' => $this->warehouse_name ?? '',
|
|
'country_id' => $this->country_id,
|
|
'country' => $this->country ? $this->country->name : '',
|
|
'type' => $this->type,
|
|
'first_weight' => $this->first_weight,
|
|
|
|
'first_weight_fee' => $this->first_weight_fee,
|
|
'continuation_weight_max' => $this->continuation_weight_max,
|
|
'add_weight' => $this->add_weight,
|
|
'continuation_weight_fee' => $this->continuation_weight_fee,
|
|
'num_fee' => $this->num_fee,
|
|
'throwing_ratio' => $this->throwing_ratio,
|
|
'day_min' => $this->day_min,
|
|
'day_max' => $this->day_max,
|
|
'position' => $this->position,
|
|
'created_at' => time_format($this->created_at),
|
|
'deleted_at' => $this->deleted_at ? time_format($this->deleted_at) : '',
|
|
'url_edit' => admin_route('logistics.edit', $this->id),
|
|
];
|
|
|
|
return hook_filter('resource.product', $data);
|
|
}
|
|
}
|