diff --git a/app/Http/Controllers/Admin/FlightController.php b/app/Http/Controllers/Admin/FlightController.php index 4473574..c169cbb 100644 --- a/app/Http/Controllers/Admin/FlightController.php +++ b/app/Http/Controllers/Admin/FlightController.php @@ -107,6 +107,7 @@ class FlightController extends Controller 'departure_time' => [ 'required', 'date', + 'after_or_equal:today', ], 'departure_airport_id' => [ @@ -201,7 +202,7 @@ class FlightController extends Controller return redirect() ->route('admin.flights.index') - ->with('success', 'پرواز با موفقیت ایجاد شد'); + ->withErrors(['success' => 'پرواز با موفقیت ایجاد شد']); } public function edit(Flight $flight) @@ -252,6 +253,7 @@ class FlightController extends Controller 'departure_time' => [ 'required', 'date', + 'after_or_equal:today', ], 'departure_airport_id' => [ @@ -345,7 +347,7 @@ class FlightController extends Controller return redirect() ->route('admin.flights.index') - ->with('success', 'پرواز با موفقیت ویرایش شد'); + ->withErrors(['success'=> 'پرواز با موفقیت ویرایش شد']); } public function destroy(Flight $flight) diff --git a/resources/views/admin/flights/create.blade.php b/resources/views/admin/flights/create.blade.php index f9860ae..c397935 100644 --- a/resources/views/admin/flights/create.blade.php +++ b/resources/views/admin/flights/create.blade.php @@ -353,7 +353,8 @@ time: true, hasSecond: false, targetValueInput: 'attr', - targetValueType: 'attr' + targetValueType: 'attr', + minDate: 'today' }); @endsection diff --git a/resources/views/admin/flights/edit.blade.php b/resources/views/admin/flights/edit.blade.php index fd46586..b4f710b 100644 --- a/resources/views/admin/flights/edit.blade.php +++ b/resources/views/admin/flights/edit.blade.php @@ -345,7 +345,8 @@ time: true, hasSecond: false, targetValueInput: 'attr', - targetValueType: 'attr' + targetValueType: 'attr', + minDate: 'today' }); @endsection diff --git a/resources/views/admin/flights/index.blade.php b/resources/views/admin/flights/index.blade.php index 6b80527..099d794 100644 --- a/resources/views/admin/flights/index.blade.php +++ b/resources/views/admin/flights/index.blade.php @@ -25,7 +25,7 @@ {{ $message }} @enderror - @error('$errors') + @error('errors') {{ $message }} @enderror