From 5097e9fdf6b696d3d2634ea1ada111be6453282b Mon Sep 17 00:00:00 2001 From: El Houssain INANI Date: Sat, 5 Jun 2021 17:03:17 +0100 Subject: [PATCH] Fix issues with old code --- .../Controllers/OptionManagerController.php | 68 ------------------- src/Http/routes.php | 4 -- 2 files changed, 72 deletions(-) delete mode 100644 src/Http/Controllers/OptionManagerController.php diff --git a/src/Http/Controllers/OptionManagerController.php b/src/Http/Controllers/OptionManagerController.php deleted file mode 100644 index ccb1161..0000000 --- a/src/Http/Controllers/OptionManagerController.php +++ /dev/null @@ -1,68 +0,0 @@ -attach($request->get('options')); - - return redirect(route('poll.index')) - ->with('success', 'New poll options have been added successfully'); - } - - /** - * Remove the Selected Option - * - * @param Poll $poll - * @param Request $request - * @return \Illuminate\Http\RedirectResponse - */ - public function remove(Poll $poll, Request $request) - { - try{ - $poll->detach($request->get('options')); - return redirect(route('poll.index')) - ->with('success', 'Poll options have been removed successfully'); - }catch (Exception $e){ - return back()->withErrors(PollHandler::getMessage($e)); - } - } - - /** - * Page to add new options - * - * @param Poll $poll - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function push(Poll $poll) - { - return view('larapoll::dashboard.options.push', compact('poll')); - } - - /** - * Page to delete Options - * - * @param Poll $poll - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function delete(Poll $poll) - { - return view('larapoll::dashboard.options.remove', compact('poll')); - } -} \ No newline at end of file diff --git a/src/Http/routes.php b/src/Http/routes.php index 8c53424..3fe1e5a 100644 --- a/src/Http/routes.php +++ b/src/Http/routes.php @@ -16,10 +16,6 @@ Route::patch('/admin/polls/{poll}/lock', ['uses' => 'PollManagerController@lock', 'as' => 'poll.lock']); Route::patch('/admin/polls/{poll}/unlock', ['uses' => 'PollManagerController@unlock', 'as' => 'poll.unlock']); Route::post('/admin/polls', ['uses' => 'PollManagerController@store', 'as' => 'poll.store']); - Route::get('/admin/polls/{poll}/options/add', ['uses' => 'OptionManagerController@push', 'as' => 'poll.options.push']); - Route::post('/admin/polls/{poll}/options/add', ['uses' => 'OptionManagerController@add', 'as' => 'poll.options.add']); - Route::get('/admin/polls/{poll}/options/remove', ['uses' => 'OptionManagerController@delete', 'as' => 'poll.options.remove']); - Route::delete('/admin/polls/{poll}/options/remove', ['uses' => 'OptionManagerController@remove', 'as' => 'poll.options.remove']); }); Route::post('/vote/polls/{poll}', 'VoteManagerController@vote')->name('poll.vote');