28 lines
783 B
PHP
28 lines
783 B
PHP
<?php
|
|
|
|
namespace App\Endpoint\Api\Http\Resources\Dealer;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class UserProductLogResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'product_name'=> $this->product?->name,
|
|
'remark' => $this->remark,
|
|
'is_deposit' => $this->is_deposit,
|
|
'qty' => $this->qty_format.$this->product?->unit,
|
|
'created_at' => $this->created_at->toDateTimeString(),
|
|
'can_revoke' => $this->canRevoke(),
|
|
];
|
|
}
|
|
}
|