unioil-mobile-api/app/Http/Resources/ReportTopUpResource.php

28 lines
852 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class ReportTopUpResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$this->withoutWrapping();
return [
'payment_uuid' => $this->payment_uuid,
'date' => $this->paid_at != null ? date('d-M-Y h:i A',strtotime($this->paid_at)) : '',
// 'time' => $this->paid_at != null ? date('h:i A',strtotime($this->paid_at)) : '',
'card_number' => isset($this->loyaltyCard->card_number) ? $this->loyaltyCard->card_number : '',
'amount' => $this->amount,
];
}
}