public function loadPost($slug) { $inputs = array('slug' => $slug); $rules = array('slug' => 'required|alpha_dash'); $validation = Validator::make($inputs, $rules); if ($validation->passes()) { $post = Post::where('slug', $slug)->where('private', false)->first(); if ($post) { return view('redminstore::posts.view')->with('post', $post); } } return view('redminstore::general.404'); }
/** /* Get all posts. /* /* @param bool $private To retrieve private or public posts, default public. /* @return array(Post) or null if nothing found */ public static function getPosts($private = false) { $posts = Post::where('private', $private)->get(); return $posts; }