コード例 #1
0
 /**
  * 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();
     });
 }
コード例 #2
0
 public function boot()
 {
     view()->composer('layouts.main', function ($view) {
         $view->with('lines', \App\ProductLine::ordered()->get());
     });
 }
コード例 #3
0
 public function index()
 {
     $lines = ProductLine::ordered()->get();
     return view('lines.index', compact('lines'));
 }