54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class CooperationCompletionRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Auth::check() && is_role(['3']);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'payment_request_letter' => ['required', 'file', 'mimes:pdf', 'max:2048'],
|
|
'invoice' => ['required', 'file', 'mimes:pdf', 'max:2048'],
|
|
'other_document' => ['nullable', 'file', 'mimes:pdf', 'max:2048'],
|
|
'description' => ['nullable'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'payment_request_letter.required' => 'Surat permohonan pembayaran wajib diunggah.',
|
|
'payment_request_letter.file' => 'Surat permohonan pembayaran harus berupa file yang valid.',
|
|
'payment_request_letter.mimes' => 'Surat permohonan pembayaran harus berformat PDF.',
|
|
'payment_request_letter.max' => 'Ukuran surat permohonan pembayaran tidak boleh lebih dari 2MB.',
|
|
|
|
'invoice.required' => 'Invoice/Tagihan wajib diunggah.',
|
|
'invoice.file' => 'Invoice/Tagihan harus berupa file yang valid.',
|
|
'invoice.mimes' => 'Invoice/Tagihan harus berformat PDF.',
|
|
'invoice.max' => 'Ukuran Invoice/Tagihan tidak boleh lebih dari 2MB.',
|
|
|
|
'other_document.required' => 'Dokumen lainnya wajib diunggah.',
|
|
'other_document.file' => 'Dokumen lainnya harus berupa file yang valid.',
|
|
'other_document.mimes' => 'Dokumen lainnya harus berformat PDF.',
|
|
'other_document.max' => 'Ukuran dokumen lainnya tidak boleh lebih dari 2MB.',
|
|
];
|
|
}
|
|
|
|
}
|