%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/hrsys/api/app/Transformers/
Upload File :
Create Path :
Current File : /var/www/html/hrsys/api/app/Transformers/MaintenancePaymentTransformer.php

<?php

namespace App\Transformers;

use App\Models\MaintenancePayment;

class MaintenancePaymentTransformer extends BaseTransformer
{
    protected $availableIncludes = [
        'client',
    ];

    public function includeClient(MaintenancePayment $payment)
    {
        return $this->item($payment->client, new ClientTransformer(), 'client');
    }

    public function transform(MaintenancePayment $maintenancePayment)
    {
        return [
            'id'                   => $maintenancePayment->id,
            'name'                 => $maintenancePayment->name,
            'description'          => $maintenancePayment->description,
            'type'                 => $maintenancePayment->type,
            'amount'               => $maintenancePayment->amount,
            'currency'             => $maintenancePayment->currency,
            'cycle'                => $maintenancePayment->cycle,
            'is_active'            => $maintenancePayment->is_active,
            'start_date'           => $maintenancePayment->formatDate($maintenancePayment->start_date),
            'next_payment_date'    => $maintenancePayment->formatDate($maintenancePayment->next_payment_date),
            'canceled_at'          => $maintenancePayment->canceled_at
                ? $maintenancePayment->formatDate($maintenancePayment->canceled_at)
                : null,
            'is_cancelable'        => $maintenancePayment->isCancelable(),
            'can_receive_payments' => $maintenancePayment->canReceivePayments(),
            'is_due'               => $maintenancePayment->isDue(),
            'is_due_soon'          => $maintenancePayment->isDueSoon(),
        ];
    }
}

Zerion Mini Shell 1.0