/**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('partecipants', \App\Partecipant::class);
     /* versione semplice */
     $router->bind('partecipants', function ($id) {
         /*versione con opzioni specifiche*/
         return \App\Partecipant::where('id', $id)->FirstOrFail();
     });
     parent::boot($router);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     // versione modificata
     // prendo dalla richiesta fatta su url "http://laravel.app/partecipants/1", l'id = id selezionato
     $router->bind('partecipants', function ($id) {
         return \App\Partecipant::where('id', $id)->firstOrFail();
     });
     parent::boot($router);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Request $request, Partecipant $partecipant)
 {
     $partecipant->delete();
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($partecipant);
     }
     return redirect('partecipants');
 }