adrema/app/Payment/SubscriptionResource.php

30 lines
655 B
PHP
Raw Normal View History

2021-07-04 01:44:41 +02:00
<?php
namespace App\Payment;
use Illuminate\Http\Resources\Json\JsonResource;
2022-01-02 12:32:57 +01:00
/**
* @mixin Subscription
*/
2021-07-04 01:44:41 +02:00
class SubscriptionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'fee_id' => $this->fee_id,
'fee_name' => $this->fee->name,
'amount_human' => number_format($this->amount / 100, 2, ',', '.').' €',
'amount' => $this->amount,
];
}
}