fix: add error message + instruction to detach team from vacancy
Fixes #10. Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
parent
73a674096a
commit
dced0907b6
@ -153,10 +153,18 @@ class VacancyController extends Controller
|
||||
public function delete(Request $request, Vacancy $vacancy)
|
||||
{
|
||||
$this->authorize('delete', $vacancy);
|
||||
|
||||
if ($vacancy->teams->isEmpty()) {
|
||||
|
||||
$vacancy->delete();
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', __('Vacancy deleted. All applications associated with it are now gone too.'));
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', __('Please detach any teams that may be using this vacancy first.'));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user