28 lines
847 B
PHP
28 lines
847 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ReportStationRatingsResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$this->withoutWrapping();
|
|
|
|
return [
|
|
'date' => $this->created_at != null ? date('d-M-Y h:i A',strtotime($this->created_at)) : '',
|
|
'card_number' => ($this->loyaltyCard) ? $this->loyaltyCard->card_number : '',
|
|
'invoice' => isset($this->payment->trans_num)? $this->payment->trans_num : '',
|
|
'station' => $this->station->description,
|
|
'rate' => $this->rate,
|
|
];
|
|
}
|
|
}
|