Exemplo n.º 1
0
 public function store()
 {
     $input = Input::all();
     $vols = $input['checkbox'];
     foreach ($vols as $index => $value) {
         $participacion = new Participacion();
         $participacion->actividadID = $input['idActividad'];
         $participacion->voluntarioID = $index;
         $participacion->save();
     }
     return Redirect::route('admin.participaciones.index')->with('success', "<strong></strong> exitosamente adicionado en le base de datos");
 }
Exemplo n.º 2
0
 public function participacion()
 {
     $post = json_decode(file_get_contents("php://input"), true);
     $participacion = $post;
     $check = Participacion::where('id_usuario', $post['id_usuario'])->where('id_evento', $post['id_evento'])->get();
     if (count($check) == 0) {
         Participacion::create($participacion);
         echo json_encode(['Empezaste a participar en este evento :)']);
     } else {
         echo json_encode(['Usted ya se registró a este evento :(']);
     }
 }
 public function loadModel($id)
 {
     $model = Participacion::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
     }
     return $model;
 }