From a00278d3131a87d1dfc09a3913abc9ef02494a17 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Thu, 19 Apr 2018 12:39:16 +0200 Subject: [PATCH] Update ForumController and routes for deleting forum --- Changelog | 1 + app/Http/Controllers/ForumController.php | 17 +++++++++++++++++ resources/views/themes/Charisma/forumpost.tpl | 2 +- resources/views/themes/Gamma/forumpost.tpl | 2 +- resources/views/themes/Gentele/forumpost.tpl | 2 +- resources/views/themes/Omicron/forumpost.tpl | 2 +- routes/web.php | 4 ++++ 7 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index ff9eb4698..12cfdea36 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-04-19 DariusIII + * Chg: Update ForumController and routes for deleting forum * Chg: Add FailedReleasesController * Chg: Add ConsoleController * Chg: Add CommentsController diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index 367a54800..643b7956c 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -163,4 +163,21 @@ class ForumController extends BasePageController ); $this->pagerender(); } + + /** + * @param $id + * + * @return \Illuminate\Http\RedirectResponse + * @throws \Exception + */ + public function destroy($id) + { + $this->setPrefs(); + + if ($id) { + Forumpost::deletePost($id); + } + + return redirect()->back(); + } } diff --git a/resources/views/themes/Charisma/forumpost.tpl b/resources/views/themes/Charisma/forumpost.tpl index d02a70a00..25413ed1d 100755 --- a/resources/views/themes/Charisma/forumpost.tpl +++ b/resources/views/themes/Charisma/forumpost.tpl @@ -35,7 +35,7 @@
Delete
{/if} diff --git a/resources/views/themes/Gamma/forumpost.tpl b/resources/views/themes/Gamma/forumpost.tpl index 591acc6ab..c1ed1ac0e 100755 --- a/resources/views/themes/Gamma/forumpost.tpl +++ b/resources/views/themes/Gamma/forumpost.tpl @@ -34,7 +34,7 @@ {if isset($isadmin)}
- Delete + Delete
{/if} diff --git a/resources/views/themes/Gentele/forumpost.tpl b/resources/views/themes/Gentele/forumpost.tpl index ffdf1c90c..423387f81 100755 --- a/resources/views/themes/Gentele/forumpost.tpl +++ b/resources/views/themes/Gentele/forumpost.tpl @@ -40,7 +40,7 @@
Delete
{/if} diff --git a/resources/views/themes/Omicron/forumpost.tpl b/resources/views/themes/Omicron/forumpost.tpl index bbce2a81a..2fbc9a823 100755 --- a/resources/views/themes/Omicron/forumpost.tpl +++ b/resources/views/themes/Omicron/forumpost.tpl @@ -39,7 +39,7 @@
Delete
{/if} diff --git a/routes/web.php b/routes/web.php index 4a98e17ce..acf7822a4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -129,6 +129,10 @@ Route::get('post_edit', 'ForumController@edit'); Route::post('post_edit', 'ForumController@edit'); +Route::get('forum-delete/{id}', 'ForumController@destroy')->middleware('isAdmin'); + +Route::post('forum-delete/{id}', 'ForumController@destroy')->middleware('isAdmin'); + Route::get('profileedit', 'ProfileController@edit'); Route::post('profileedit', 'ProfileController@edit');