#41 - wip
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Contracts\Auth\Factory as Auth;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Toby\Domain\Enums\VacationRequestState;
|
||||
use Toby\Domain\Events\VacationRequestStateChanged;
|
||||
use Toby\Domain\VacationRequestNotificationSender;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
|
||||
@@ -16,6 +17,7 @@ class VacationRequestObserver
|
||||
public function __construct(
|
||||
protected Auth $auth,
|
||||
protected Dispatcher $dispatcher,
|
||||
protected VacationRequestNotificationSender $vacationRequestNotificationSender,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -39,6 +41,13 @@ class VacationRequestObserver
|
||||
}
|
||||
}
|
||||
|
||||
public function updated(VacationRequest $vacationRequest): void
|
||||
{
|
||||
if ($vacationRequest->state !== VacationRequestState::CREATED) {
|
||||
$this->vacationRequestNotificationSender->sendVacationRequestNotification($vacationRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected function fireStateChangedEvent(
|
||||
VacationRequest $vacationRequest,
|
||||
?VacationRequestState $from,
|
||||
|
Reference in New Issue
Block a user