Esempio n. 1
0
<?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 controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $news = App\News::orderBy('date', 'desc')->take(10)->get();
    return view('index', ['news' => $news]);
});
Route::resource('characters', 'CharacterController');
Route::resource('class', 'ClassController');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Esempio n. 2
0
| 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 controller to call when that URI is requested.
|
*/
use Illuminate\Http\Request;
$categories = App\Category::whereNotIn('id', [1])->get();
View::share('categories', $categories);
$configuracion = new App\Configuration();
View::share('configuration', $configuracion);
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::get('/', function () use($configuracion) {
    setlocale(LC_TIME, 'es_ES.utf8');
    $homeBanner = App\Gallery::find(intval($configuracion->home_slider));
    $homeCollectionBanner = App\Gallery::tag('home_collection_banner');
    return view('pages.home', ['products' => App\Product::with('colors', 'category')->orderBy('created_at', 'desc')->take(3)->get(), 'news' => App\News::orderBy('created_at', 'desc')->take(2)->get(), 'home_banner' => $homeBanner, 'home_collection_banner' => $homeCollectionBanner]);
});
Route::get('/productos', function (Request $request) {
    $category = App\Category::with('gallery')->where('slug', 'productos')->first();
    $productos = App\Product::with('colors');
    $search = $request->input('s');
    if (isset($search) && !empty($search)) {
        $productos->where('title', 'like', "%{$search}%")->orWhere('subtitle', 'like', "%{$search}%");
    }
    $productos = $productos->paginate(6);
    return view('pages.catalog', ['categoria' => $category, 'productos' => $productos])->render();
});
Route::get('/productos/{categoria}', function (Request $request, $categoria) {
    $category = App\Category::with('gallery')->where('slug', $categoria)->first();
    $productos = App\Product::with('colors', 'category')->where('category_id', $category->id);
    $search = $request->input('s');