public function home() { //appel des composants en base $headings = Heading::all(); $slides = Slide::all(); $featurets = Featuret::all(); //retour de la vue return View::make('home', array('headings' => $headings, 'slides' => $slides, 'featurets' => $featurets)); }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::pattern('id', '[0-9]+'); Route::pattern('alias', '[0-9a-z_-]+'); Route::get('/', function () { return View::make('hello', ['categories' => Category::where('parent_id', 0)->get(), 'slides' => Slide::all()]); }); Route::match(array('GET', 'POST'), '/catalog', function () { $categories = Category::where('parent_id', 0)->get(); if ($q = Input::get('q')) { $products = Product::where('title', 'LIKE', '%' . $q . '%')->orWhere('description', 'LIKE', '%' . $q . '%')->orderBy('updated_at', 'desc')->paginate(6); if (Request::ajax()) { return Response::json(['titles' => $products->lists('title'), 'aliases' => $products->lists('alias')]); } } else { $products = []; } return View::make('catalog', ['categories' => $categories, 'products' => $products]); }); Route::get('/catalog/categories/{alias}', function ($alias = null) { $categories = Category::where('parent_id', 0)->get();
public function getIndex() { $this->layout->content = View::make('admin.slide')->with('dadosSlide', Slide::all()); }