/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $this->bind('package', function ($slug) { return Package::with('information', 'tickets.information', 'photos')->whereSlug($slug)->firstOrFail(); }); $this->bind('category', function ($slug) { return Category::whereSlug($slug)->firstOrFail(); }); $this->bind('packages', function ($id) { return Package::with('information', 'tickets.information', 'photos')->findOrFail($id); }); $this->bind('categories', function ($id) { return Category::findOrFail($id); }); $this->bind('deal', function ($slug) { return Deal::with('photos')->whereSlug($slug)->first(); }); $this->bind('deals', function ($id) { return Deal::findOrFail($id); }); parent::boot($router); }
public function find($id) { return Deal::findOrFail($id); }