diff --git a/app/Http/Controllers/PresentationController.php b/app/Http/Controllers/PresentationController.php index a89fb03..e058127 100644 --- a/app/Http/Controllers/PresentationController.php +++ b/app/Http/Controllers/PresentationController.php @@ -212,12 +212,12 @@ public function destroy(string $id) foreach($schedules as $schedule) { if($schedule->end_date < now()) { - $schedule->presentation_id = null; + $schedule->presentation_id = 0; $schedule->save(); + } else { + return redirect()->back()->withErrors(['message' => __('Presentation is assigned to schedules')]); } } - - return redirect()->back()->withErrors(['message' => __('Presentation is assigned to schedules')]); } // Delete all files