function deleteUser() { if (!($user = User::getById((int) Route::getCurrentRoute()->values['userId']))) { Notification::setError('userNotFound'); Route::redirectTo(); return; } $user->delete(); Notification::setStatus('userDeleted'); Route::redirectTo('users'); }