public static function getTiposParticipantesList()
 {
     return ['0' => 'Asistentes...'] + TiposParticipantes::Select('id', 'tipo_participante')->where('activo', true)->orderBy('tipo_participante', 'ASC')->Lists('tipo_participante', 'id');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     //Título Vista
     $titulo = "Modificar Cursillo";
     $cursillo = Cursillos::find($id);
     if ($cursillo == null) {
         return redirect('cursillos')->with("No se ha encontrado el cursillo seleccionado.");
     }
     $tipos_participantes = TiposParticipantes::getTiposParticipantesList();
     //Vista
     return view('cursillos.modificar', compact('cursillo', 'comunidades', 'tipos_participantes', 'titulo'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $tipoParticipante = TiposParticipantes::find($id);
     if ($tipoParticipante == null) {
         return Redirect('tiposParticipantes')->with('mensaje', 'No se encuentra el tipo de participante seleccionado.');
     }
     try {
         $tipoParticipante->delete();
     } catch (\Exception $e) {
         switch ($e->getCode()) {
             case 23000:
                 return redirect()->route('tiposParticipantes.index')->with('mensaje', 'El tipo de participante ' . $tipoParticipante->tipo_participante . ' no se puede eliminar al tener cursillos asociados.');
                 break;
             default:
                 return redirect()->route('tiposParticipantes.index')->with('mensaje', 'Eliminar tipo participante error ' . $e->getCode());
         }
     }
     return redirect()->route('tiposParticipantes.index')->with('mensaje', 'El tipo de participante ' . $tipoParticipante->tipo_participante . ' ha sido eliminado correctamente.');
 }