/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('products', function ($slug) { return ProductLine::where('slug', $slug)->firstOrFail(); }); $router->bind('code', function ($code) { return Product::where('code', $code)->firstOrFail(); }); $router->bind('industries', function ($slug) { return Industry::where('slug', $slug)->firstOrFail(); }); }
public function boot() { view()->composer('layouts.main', function ($view) { $view->with('lines', \App\ProductLine::ordered()->get()); }); }
public function index() { $lines = ProductLine::ordered()->get(); return view('lines.index', compact('lines')); }