/** * Remove the forum. * * @param Model $forum * * @return Response */ public function destroy(ForumAdminRequest $request, Forum $forum) { try { $t = $forum->delete(); return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('forum::forum.name')]), 'code' => 202, 'redirect' => trans_url('/admin/forum/forum/0')], 202); } catch (Exception $e) { return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/forum/forum/' . $forum->getRouteKey())], 400); } }
public function transform(\Litecms\Forum\Models\Forum $forum) { return ['id' => $forum->getRouteKey(), 'parent_id' => $forum->parent_id == 0 ? 'Parent' : ucfirst($forum->parent->title), 'category_id' => @ucfirst($forum->category->name), 'title' => ucfirst($forum->title), 'description' => $forum->description, 'status' => $forum->status, 'published' => $forum->published == 'Yes' ? 'Published' : 'Pending', 'best_answer' => $forum->best_answer]; }
/** * Publish the specified resource. * * @param Request $request * @param Forum $forum * * @return Response */ public function publish(ForumUserRequest $request, Forum $forum) { try { $this->repository->update($request->all(), $forum->getRouteKey()); return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('forum::forum.name')]), 'code' => 202, 'redirect' => trans_url('/user/forum/forum/' . $forum->getRouteKey())], 202); } catch (Exception $e) { redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400); } }
public function transform(\Litecms\Forum\Models\Forum $forum) { return ['id' => $forum->getRouteKey(), 'parent_id' => $forum->parent_id, 'category_id' => $forum->category_id, 'title' => $forum->title, 'description' => $forum->description, 'status' => $forum->status, 'published' => $forum->published, 'best_answer' => $forum->best_answer]; }