Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
peripherad
/
app
/
Http
/
Requests
/
Admin
:
PaymentCollectionReportRequest.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace App\Http\Requests\Admin; use App\Models\Order; use App\Models\ReportJobsCompletedDetailed; use App\Models\ReportPaymentsCollection; use Illuminate\Foundation\Http\FormRequest; use Gate; class PaymentCollectionReportRequest extends FormRequest { public function authorize() { return Gate::allows('jobs_completed_comparison_access'); } public function rules() { return [ 'report_type' => [ 'nullable', 'in:'. implode(',', array_keys(ReportPaymentsCollection::REPORTS_MODE)) ], 'payment_type' => [ 'nullable', 'in:'. implode(',', array_keys(Order::PAYMENT_TYPE_RADIO)) ], 'year_from' => [ 'required_if:report_type,custom', 'date_format:Y', ], 'year_to' => [ 'required_if:report_type,custom', 'date_format:Y', 'after_or_equal:year_from', ], 'date' => [ 'required_if:report_type,monthly', 'date_format:Y-m', 'before:tomorrow', ], ]; } public function messages() { return [ 'year_from.date_format' => 'The year from should be a valid 4 digit year.', 'year_to.date_format' => 'The year to should be a valid 4 digit year.', ]; } }