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

28 lines
656 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class TopUpResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$this->withoutWrapping();
return [
'topup_uuid' => $this->topup_uuid,
'fee_code' => $this->fee_code,
'name' => $this->name,
'type' => $this->type == 1 ? 'PH peso' : 'Percentage',
'amount' => number_format($this->amount, 2, '.','')
];
}
}