public function edit($id) { $title = Lang::get('admin/blogs/title.blog_update'); $post = $this->post->with('rubrics')->find($id); $rubrics = \Rubric::all(); if (is_null($post)) { return Redirect::route('admin.blogs.index'); } return View::make('admin/blogs/edit', compact('post', 'title', 'rubrics')); }
public function show($slug) { $title = Lang::get('admin/blogs/title.blog_show'); $post = $this->post->where('slug', $slug)->firstOrFail(); $rubrics = \Rubric::all(); // FIXME В mysql RAND()! $rubric = $another_posts = $post->rubrics()->first(); if (!is_null($rubric)) { $another_posts = $rubric->posts()->orderBy(DB::raw("RAND()"))->take(4)->get(); } else { $another_posts = []; } return View::make('blogs/show', compact('post', 'title', 'rubrics', 'another_posts')); }
public function index() { $title = Lang::get('admin/blogs/title.blog_management'); $rubrics = \Rubric::all(); return View::make('admin/blogs/rubrics/index', compact('title', 'rubrics')); }