/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $router->model('effects', 'App\\Effect'); $router->model('potion-effects', 'App\\PotionEffect'); $router->bind('potions', function ($id) { return Potion::with('ingredients')->where('id', $id)->first(); }); $router->bind('ingredients', function ($id) { return Ingredient::with('effects')->where('id', $id)->first(); }); parent::boot($router); }
public function destroy(Potion $potion) { $potion->delete(); }