Skip to content

Commit e56fc36

Browse files
committed
fix: rejected event timeslot is available again
1 parent 0f8e0ec commit e56fc36

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/Services/AdminEventService.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace App\Services;
44

55
use App\Enums\EventsEnum;
6+
use App\Enums\StatusEnum;
67
use App\Models\Event;
8+
use App\Models\InstructorAvailability;
79

810
class AdminEventService
911
{
@@ -25,5 +27,10 @@ public function acceptEvent(Event $event): Event
2527
public function rejectEvent(Event $event): void
2628
{
2729
$event->update(['status' => EventsEnum::REJECTED->value]);
30+
31+
InstructorAvailability::where('instructor_id', $event->instructor_id)
32+
->where('start_time', $event->start)
33+
->where('end_time', $event->end)
34+
->update(['status' => StatusEnum::AVAILABLE->value]);
2835
}
2936
}

0 commit comments

Comments
 (0)