コード例 #1
0
 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;
 }
コード例 #2
0
 public function index()
 {
     $posts = Post::orderby('name', 'ASC')->get();
     return view('posts.index', compact('posts'));
 }