예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 public function destroy(Potion $potion)
 {
     $potion->delete();
 }