public function get_homepage() { $view = view::make("Theme::index"); $posts = Post::orderby('created_at', 'desc')->get(); $features = Post::where("type", "=", "feature")->get(); if (Post::where("url", "=", "/")->first()) { $view->post = Post::where("url", "=", "/")->first(); } else { die("no homepage set"); } $view->features = $features; $view->posts = $posts; return $view; }
public function index() { $posts = Post::orderby('name', 'ASC')->get(); return view('posts.index', compact('posts')); }