Ejemplo n.º 1
0
 public function index()
 {
     $page = 1;
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $news = News::paginate("news.published = true AND news.publish_at < NOW()", "news.publish_at DESC", $page, 10);
     $this->assign("page", $news);
     if (isset($_GET['rss'])) {
         // We don't want to clear flash data
         if (isset($this->site['flash'])) {
             $_SESSION['flash'] = $this->site['flash'];
         }
         header("Content-Type: application/rss+xml");
         $this->render("news/index.rss.tpl", true);
     } else {
         $this->title = "News Archive";
         $this->render("news/index.tpl");
     }
 }
Ejemplo n.º 2
0
 public function news()
 {
     $news = News::paginate(4);
     //分页显示
     return View::make('home.news')->with('news', $news);
 }
Ejemplo n.º 3
0
 public function index()
 {
     $page = 1;
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $news = News::paginate(null, "news.publish_at DESC", $page, 20);
     $this->assign("page", $news);
     $this->title = "News";
     $this->render("news/index.tpl");
 }
Ejemplo n.º 4
0
 public function newsEdit()
 {
     $news = News::paginate(10);
     return View::make('admin.news-edit')->with('news', $news);
 }
Ejemplo n.º 5
0
    }
    return View::make('catalog', ['categories' => $categories, 'products' => $products]);
});
Route::get('/catalog/categories/{alias}', function ($alias = null) {
    $categories = Category::where('parent_id', 0)->get();
    $category = Category::where('alias', $alias)->firstOrFail();
    $products = Product::where('category_id', $category->id)->orderBy('updated_at', 'desc')->paginate(6);
    return View::make('catalog', ['categories' => $categories, 'category' => $category, 'products' => $products]);
});
Route::get('/catalog/products/{alias}', function ($alias = null) {
    $categories = Category::where('parent_id', 0)->get();
    $product = Product::where('alias', $alias)->firstOrFail();
    return View::make('product', ['categories' => $categories, 'product' => $product]);
});
Route::get('/news', function () {
    $news = News::paginate(10);
    return View::make('news', ['news' => $news]);
});
Route::match(array('get', 'post'), '/contacts', function () {
    if (Request::isMethod('post')) {
        // send email
        Mail::send('emails.contact', Input::all(), function ($message) {
            $message->from(Input::get('email'), Input::get('name'));
            $message->to('*****@*****.**')->subject('Message from bumagi.by');
        });
    }
    return View::make('contacts');
});
Route::get('cart/order', 'CartController@order');
Route::resource('cart', 'CartController', array('only' => array('index', 'store', 'destroy')));
// Confide routes