Decrease vacancy slots by one when firing approval event

This commit is contained in:
2021-11-16 17:00:01 +00:00
parent 54b0d746fa
commit e46ebfc63a
3 changed files with 17 additions and 2 deletions

View File

@@ -108,8 +108,7 @@ class CountVotes extends Command
if ($pollResult) {
$this->info('✓ Dispatched promotion event for applicant '.$application->user->name);
if (! $this->option('dryrun')) {
$application->response->vacancy->vacancyCount -= 1;
$application->response->vacancy->save();
$application->response->vacancy->decrease();
event(new ApplicationApprovedEvent(Application::find($application->id)));
} else {