git commit "fix: persianDatepicker did not initialize due to jQuery loading after content
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
@@ -44,8 +45,22 @@ class FlightStoreRequest extends FormRequest
|
||||
'max:100'
|
||||
],
|
||||
'departure_date' => [
|
||||
'required'
|
||||
],
|
||||
'required',
|
||||
function ($attribute, $value, $fail) {
|
||||
|
||||
try {
|
||||
$gregorian = Verta::parse($value)
|
||||
->formatGregorian('Y-m-d');
|
||||
} catch (\Exception $e) {
|
||||
$fail('تاریخ حرکت معتبر نیست.');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($gregorian < now()->format('Y-m-d')) {
|
||||
$fail('تاریخ حرکت نمیتواند قبل از تاریخ امروز باشد.');
|
||||
}
|
||||
},
|
||||
],
|
||||
'departure_time' => [
|
||||
'required',
|
||||
'date_format:H:i'
|
||||
@@ -69,7 +84,7 @@ class FlightStoreRequest extends FormRequest
|
||||
'min:0'
|
||||
],
|
||||
'image' => [
|
||||
'required',
|
||||
$this->isMethod('put') || $this->isMethod('patch') ? 'nullable' : 'required',
|
||||
'image',
|
||||
'mimes:jpg,jpeg,png,webp',
|
||||
'max:2048'
|
||||
|
||||
Reference in New Issue
Block a user