/** * Display a listing of the resource. * * @return Response */ public function index() { $contents = Content::all(); return view('post.index', compact('contents')); }
/** * Get all contents * * @param Content $content * @return \Illiminate\Http\JsonResponse */ public function json() { return response()->json(['data' => Content::all()]); }
public function delete(Request $request) { /* * Find the product and delete it */ $content_to_delete = Content::find($request->id); if ($content_to_delete->delete()) { return view('cms.content', ['contents' => Content::all()]); } else { die("There was an error deleting the copy!"); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $contents = Content::all(); $categories = DB::table('categories')->select('categories.id', 'categories.title', 'categories.level', DB::raw("(CASE categories.level \n WHEN 0 THEN LPAD(categories.ordering,5,0)\n WHEN 1 THEN (SELECT CONCAT(LPAD(m.ordering,5,0), '.' ,LPAD(categories.ordering,5,0)) FROM categories as m WHERE m.id=categories.parent_id)\n WHEN 2 THEN (SELECT CONCAT((SELECT LPAD(super.ordering,5,0) FROM categories AS super WHERE super.id = m.parent_id), '.' , LPAD(m.ordering,5,0), '.' ,LPAD(categories.ordering,5,0)) FROM categories as m WHERE m.id=categories.parent_id)\n END) AS Pos"))->where('status', 1)->orderBy('Pos')->get(); return View('admin.contents.create_content')->with(['categories' => $categories]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $contents = Content::all(); return view('dashboard', compact('contents')); }