EscolaLMS/payments

View on GitHub
src/Http/Requests/Admin/PaymentExportRequest.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace EscolaLms\Payments\Http\Requests\Admin;

use EscolaLms\Payments\Enums\ExportFormatEnum;
use EscolaLms\Payments\Models\Payment;
use Illuminate\Validation\Rule;

class PaymentExportRequest extends PaymentsSearchAdminRequest
{
    public function authorize(): bool
    {
        return $this->user('api') && $this->user('api')->can('export', Payment::class);
    }

    public function rules()
    {
        return array_merge(parent::rules(), [
            'format' => ['sometimes', 'string', Rule::in(ExportFormatEnum::getValues())],
        ]);
    }
}