30 lines
950 B
PHP
30 lines
950 B
PHP
<?php
|
|
|
|
namespace App\Endpoint\Api\Http\Resources\Dealer;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class DealerEarningSimpleResource 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,
|
|
'type' => $this->type_name,
|
|
'created_at' => $this->created_at->toDateTimeString(),
|
|
'total_earnings'=> $this->total_earnings,
|
|
'status' => $this->status_format,
|
|
'status_name' => $this->status_name,
|
|
'is_payer' => $this->payer_id ? ($this->payer_id == $request->user()->id) : false,
|
|
'beneficiary_phone' => $this->user?->phone ?? '',
|
|
// 'settle_at'
|
|
];
|
|
}
|
|
}
|