Exemplo n.º 1
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('user', function ($value) {
         return \App\User::whereSlug($value)->firstOrFail();
     });
     $router->bind('category', function ($value) {
         return \App\Category::whereSlug($value)->firstOrFail();
     });
     $router->bind('event', function ($value) {
         return \App\Event::whereSlug($value)->firstOrFail();
     });
     $router->bind('city', function ($value) {
         return \App\City::where('iata', $value)->firstOrFail();
     });
     $router->bind('subscriber', function ($value) {
         return \App\Subscriber::where('token', $value)->firstOrFail();
     });
     parent::boot($router);
 }
Exemplo n.º 2
0
 /**
  * @param $slug
  */
 public function show($slug)
 {
     $event = Event::whereSlug($slug)->firstorFail();
     dd($event);
     return view('events.show')->withEvent($event);
 }