diff --git a/app/Http/Controllers/DevToolsController.php b/app/Http/Controllers/DevToolsController.php index d69665c..c474a19 100755 --- a/app/Http/Controllers/DevToolsController.php +++ b/app/Http/Controllers/DevToolsController.php @@ -47,20 +47,33 @@ class DevToolsController extends Controller ->with('applications', Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get()); } + /** + * Force an application to be approved. + */ public function forceApprovalEvent(Request $request) { $this->singleAuthorise(); - $application = Application::find($request->application); - if (! is_null($application)) { - event(new ApplicationApprovedEvent($application)); + event(new ApplicationApprovedEvent($application)); - $request->session()->flash('success', __('Event dispatched! Please check the debug logs for more info')); - } else { - $request->session()->flash('error', __('Application doesn\'t exist!')); - } + return redirect() + ->back() + ->with('success', __('Event dispatched; Candidate approval sequence initiated.')); + } - return redirect()->back(); + /** + * Force an application to be rejected. + */ + public function forceRejectionEvent(Request $request) + { + $this->singleAuthorise(); + $application = Application::findOrFail($request->application); + + event(new ApplicationDeniedEvent($application)); + + return redirect() + ->back() + ->with('success', __('Event dispatched; Candidate rejection sequence initiated.')); } public function evaluateVotes() { diff --git a/resources/views/dashboard/administration/devtools.blade.php b/resources/views/dashboard/administration/devtools.blade.php index b30c6e3..c8657ae 100755 --- a/resources/views/dashboard/administration/devtools.blade.php +++ b/resources/views/dashboard/administration/devtools.blade.php @@ -60,7 +60,7 @@ - +
@csrf diff --git a/routes/web.php b/routes/web.php index 9f28c93..2f8a909 100755 --- a/routes/web.php +++ b/routes/web.php @@ -311,9 +311,11 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo ->name('devTools'); - Route::post('/applications/force-approval', [DevToolsController::class, 'forceApprovalEvent']); Route::post('/applications/force-approval', [DevToolsController::class, 'forceApprovalEvent']) ->name('devForceApprovalEvent'); + + Route::post('/applications/force-rejection', [DevToolsController::class, 'forceRejectionEvent']) + ->name('devForceRejectionEvent'); Route::post('/applications/count-votes', [DevToolsController::class, 'evaluateVotes']) ->name('devForceEvaluateVotes');