public function actionDelete() { $type = $_POST['type']; switch ($_POST['type']) { case 'message': $model = ForumMessage::deleteAll(['id' => $_POST['id']]); return json_encode(['status' => 1]); break; case 'post': $model = \app\models\ForumPost::deleteAll(['id' => $_POST['id']]); return json_encode(['status' => 1]); break; default: break; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(ForumPost $forum_post) { $forum_post->delete(); return Redirect::route('Forum.post.index')->with('message', 'Forum deleted.'); }