예제 #1
0
 public function actionIndex()
 {
     $query = Event::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $events = $query->orderBy('date')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['events' => $events, 'pagination' => $pagination]);
 }
예제 #2
0
 public function actionOtchet()
 {
     $this->layout = false;
     $poisk1 = Yii::$app->request->post('from_date');
     $poisk2 = Yii::$app->request->post('to_date');
     return $this->render('otchet', ['model' => Event::find()->where(['between', 'date_event', $poisk1, $poisk2])->orderBy('date_event, time_event')->all(), 'poisk1' => $poisk1, 'poisk2' => $poisk2]);
 }
예제 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     if (\Yii::$app->user->isGuest) {
         return null;
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return null;
     } else {
         if (!$user->admin) {
             $organisations = $user->organisations;
             foreach ($organisations as $organisation) {
                 $query->orWhere(['owner_id' => $organisation->id]);
             }
         }
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'owner_id' => $this->owner_id, 'start_time' => $this->start_time, 'end_time' => $this->end_time]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'summary', $this->summary]);
     return $dataProvider;
 }
예제 #4
0
 /**
  * Lists all Event models.
  * @return mixed
  */
 public function actionIndex($id = null)
 {
     //Check user level & existence of $id
     $id = Yii::$app->user->identity->level == 0 && $id != null ? $id : Yii::$app->user->id;
     //$searchModel = new EventSearch();
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['events' => Event::find()->where('FIND_IN_SET(' . $id . ', shared_with)')->orWhere('user_id=' . $id)->all()]);
 }
예제 #5
0
 /**
  * Выводит событие
  *
  * @param int $id идентификатор события
  *
  * @return string
  * @throws \cs\web\Exception
  */
 public function actionEvents_item($id)
 {
     $item = Event::find($id);
     if (is_null($item)) {
         throw new Exception('Событие не найдено');
     }
     return $this->render(['item' => $item]);
 }
예제 #6
0
 public function getRoom($eventId)
 {
     $event = Event::find($eventId);
     $room = $event->room;
     if (!$room) {
         return $this->respondNotFound('Room Not Found!');
     }
     return $this->respond([$room->toArray()]);
 }
예제 #7
0
 public function eventPost($id)
 {
     //
     $event = Event::find($id);
     $posts = $event->posts;
     $response = new \stdClass();
     $response->success = true;
     $response->total = count($posts);
     $response->data = $posts;
     return response()->json($response);
 }
예제 #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //dd(Input::get('data'));
     $data = Input::get('data');
     foreach ($data as $key => $value) {
         if (Event::find($value['id']) != null) {
             Event::find($value['id'])->update(['title' => $value['title'], 'start' => $value['start'], 'end' => $value['end']]);
         } else {
             Event::create(array('title' => $value['title'], 'start' => $value['start'], 'end' => $value['end']));
         }
     }
 }
 /**
  * Lists all Event models.
  * @return mixed
  */
 public function actionIndex()
 {
     $events = Event::find()->all();
     $tasks = [];
     foreach ($events as $eve) {
         $event = new \yii2fullcalendar\models\event();
         $event->id = $eve->id;
         $event->title = $eve->title;
         $event->start = $eve->created_date;
         $tasks[] = $event;
     }
     return $this->render('index', ['events' => $tasks]);
 }
예제 #10
0
 /**
  * AJAX
  * Добавляет site_update
  * Делает рассылку
  *
  * @param integer $id - идентификатор события
  *
  * @return string
  */
 public function actionSubscribe($id)
 {
     $item = \app\models\Event::find($id);
     if (is_null($item)) {
         return self::jsonError(101, 'Не найдено событие');
     }
     $start = microtime(true);
     Subscribe::add($item);
     SiteUpdate::add($item);
     $item->update(['is_added_site_update' => 1]);
     \Yii::info(microtime(true) - $start, 'gs\\actionSubscribe');
     return self::jsonSuccess();
 }
예제 #11
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_date' => $this->created_date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
예제 #12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'start' => $this->start, 'finish' => $this->finish, 'is_allday' => $this->is_allday, 'created' => $this->created]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'roomid', $this->roomid])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'start' => $this->start, 'end' => $this->end, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #14
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request, $eventId)
 {
     $input = Input::except('token');
     $roomId = Event::find($eventId)->room->id;
     $tableType = $table = new Table();
     $validator = $table->getValidator($input);
     if ($validator->fails()) {
         return $this->respondInvalidData($validator->errors());
     }
     $table->fill($input);
     $table->room_id = $roomId;
     $table->save();
     return $this->respondCreateSuccess('Table: ' . $table->table_name . ' created');
 }
예제 #15
0
파일: Event.php 프로젝트: Sywooch/arenda
 public function validateTime1($attribute)
 {
     if (!$this->hasErrors()) {
         if ($this->isNewRecord) {
             $timeprov = Event::find()->where(['date_event' => $this->date_event, 'id_zal' => $this->id_zal])->all();
             foreach ($timeprov as $timeprovdet) {
                 $t = explode(' - ', $timeprovdet->time_event);
                 if ($this->time_c >= $t[0] and $this->time_c <= $t[1]) {
                     $this->addError($attribute, 'В это время зал занят');
                 }
             }
         }
     }
 }
예제 #16
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $today)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['date_event' => SORT_DESC, 'time_event' => SORT_ASC]]]);
     $dataProvider->pagination->pageSize = 10;
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'id_zal' => $this->id_zal, 'id_client' => $this->id_client, 'id_users' => $this->id_users, 'id_users1' => $this->id_users1, 'date_event' => $this->date_event, 'status' => $this->status, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'name_event', $this->name_event])->andFilterWhere(['like', 'oborud', $this->oborud])->andFilterWhere(['like', 'time_event', $this->time_event])->andFilterWhere(['like', 'kofebrayk', $this->kofebrayk])->andFilterWhere(['like', 'furshet', $this->furshet])->andFilterWhere(['like', 'dopinfo', $this->dopinfo])->andFilterWhere(['like', 'date_event', $today]);
     return $dataProvider;
 }
예제 #17
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'event', $this->event])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
 public static function getUserEvents(UserId $uid, $sort = true)
 {
     if ($sort) {
         $e = Event::find()->where(['event_owner' => $uid->getId()])->orderBy(['date' => SORT_DESC])->all();
     } else {
         $e = Event::findAll(['event_owner' => $uid->getId()]);
     }
     $events = [];
     foreach ($e as $event) {
         $type = EEvent::search($event->event_type);
         $uconnected = $event->event_user_connected == null ? null : new UserId($event->event_user_connected);
         $ev = new UserEvent($event->event_id, EEvent::$type(), $uid, new \DateTime($event->date), $uconnected, $event->event_data_connected);
         $events[] = $ev;
     }
     return $events;
 }
예제 #19
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'allDay' => $this->allDay, 'start' => $this->start, 'end' => $this->end, 'editable' => $this->editable]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'dow', $this->dow])->andFilterWhere(['like', 'className', $this->className])->andFilterWhere(['like', 'source', $this->source])->andFilterWhere(['like', 'color', $this->color])->andFilterWhere(['like', 'backgroundColor', $this->backgroundColor])->andFilterWhere(['like', 'borderColor', $this->borderColor])->andFilterWhere(['like', 'textColor', $this->textColor]);
     return $dataProvider;
 }
예제 #20
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'jadwal' => $this->jadwal]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'deskripsi', $this->deskripsi]);
     return $dataProvider;
 }
예제 #21
0
 /**
  * Creates a new Peserta model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Peserta();
     $this->layout = 'frontend.php';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $subject = "Pendaftaran Seminar di Unpar Career Expo";
         $content = "Dear {$model->nama}, <br>\n            Terima kasih telah mendaftar di seminar Unpar Career Expo November 2015. <br>\n            Berikut adalah daftar seminar yang Anda ikuti:<br><br>\n            <ul>\n            ";
         foreach ($model->eventsData as $event) {
             $content .= "<li><span class='event-detail'><b>{$event->nama}</b><br>{$event->deskripsi}<br><small>{$event->jadwal}</small></span><br><br></li>";
         }
         $content .= "</ul><br><br>\n            <b>Lokasi Seminar: </b><br>\n            Universitas Katolik Parahyangan <br>\n            Jl. Ciumbuleuit No. 94 <br>\n            Bandung - 40141 <br>\n            Gedung Rektorat <br>\n            Ruang Operation Room <br><br>\n            Sampai jumpat di acara seminarnya. Jika memerlukan bantuan silakan hubungi kami di:<br>\n            +62-22-2032655 ext. 100120 / 100126 <br>\n            Dian - 0857 4105 3212<br><br>\n            Best regards,<br>Panitia Unpar Career Expo & Seminar";
         Yii::$app->mailer->compose()->setFrom(Yii::$app->params['adminEmail'])->setHtmlBody($content)->setSubject($subject)->setTo($model->email)->send();
         Yii::$app->session->setFlash('success', 'Pendaftaran berhasil! Terima kasih.');
         return $this->refresh();
     } else {
         $model_event = Event::find()->all();
         return $this->render('create', ['model' => $model, 'model_event' => $model_event]);
     }
 }
예제 #22
0
 public function actionAdmin()
 {
     $this->layout = 'admin';
     $searchModel = new EventSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $dataProvider->sort->defaultOrder = ['id' => 'DESC'];
     $models = Event::find()->with('room')->all();
     //var_dump($models);
     $events = array();
     foreach ($models as $value) {
         $event = new \yii2fullcalendar\models\Event();
         //$event->id = $value->id;
         $event->title = $value->title . ' ห้อง ' . $value->room->roomnum;
         $event->start = date('Y-m-d', strtotime($value->start));
         $event->end = date('Y-m-d', strtotime('+1 day', strtotime($value->finish)));
         $event->color = $value->room->color;
         $events[] = $event;
     }
     return $this->render('admin', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'events' => $events]);
 }
예제 #23
0
 /**
  * Delete a Manager of an Event.
  *
  * @param  Request  $request
  * @param  int  $eid
  * @param  int  $uid
  * @return Response
  */
 public function destroy(Request $request, $eid, $uid)
 {
     try {
         $user = $this->isEventManager($request, $eid);
         if (!$user) {
             return response()->error(403, 'You are not a manager of this event!');
         }
         $event = Event::find($eid);
         if (!$event) {
             return response()->error(404, 'Event Not Found');
         }
         $user = User::find($uid);
         if (!$user) {
             return response()->error(404, 'User Not Found');
         }
         $event->managers()->detach($user);
         return response()->success();
     } catch (Exception $e) {
         return response()->error();
     }
 }
예제 #24
0
 /**
  * Delete a Passenger of an Event Vehicle.
  *
  * @param  Request  $request
  * @param  int  $eid
  * @param  int  $vid
  * @param  int  $pid
  * @return Response
  */
 public function destroy(Request $request, $eid, $vid, $pid)
 {
     try {
         $event = Event::find($eid);
         if (!$event) {
             return response()->error(404, 'Event Not Found');
         }
         $vehicle = EventVehicle::find($vid);
         if (!$vehicle) {
             return response()->error(404, 'Vehicle Not Found');
         }
         $profile = Profile::find($pid);
         if (!$profile) {
             return response()->error(404, 'Profile Not Found');
         }
         $vehicle->passengers()->detach($profile);
         $vehicle->decrement('passenger_count');
         return response()->success();
     } catch (Exception $e) {
         return response()->error($e);
     }
 }
예제 #25
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($event_id)
 {
     $event = Event::find($event_id);
     if ($event->cancelled || empty($event)) {
         Session::flash('message', 'Evento cancelado');
         Session::flash('alert-class', 'alert-warning');
         return redirect('promoter/event/record');
     }
     $amountAccumulated = $event->amountAccumulated();
     $amountComission = $amountAccumulated * $event->percentage_comission / 100;
     $totalToPay = $amountAccumulated - $amountComission;
     $paid = Payment::where("event_id", $event_id)->sum('paid');
     $debt = 0;
     if ($totalToPay > $paid) {
         $debt = $totalToPay - $paid;
     }
     if ($debt <= 0) {
         Session::flash('message', 'No se puede transferir, tiene deuda igual a cero');
         Session::flash('alert-class', 'alert-warning');
         return redirect('promoter/event/record');
     }
     $objs = array("event" => $event, "amountAccumulated" => $amountAccumulated, "benefit" => $amountComission, "totalToPay" => $totalToPay, "paid" => $paid, "debt" => $debt);
     return view('internal.promoter.payment.create', $objs);
 }
 public function cancelStorage(StorePresentationRequest $request, $presentation_id)
 {
     $user_id = Auth::user()->id;
     $input = $request->all();
     $presentation = Presentation::findOrFail($presentation_id);
     $presentation->cancelled = "1";
     $presentation->save();
     $event = Event::find($presentation->event_id);
     if ($event->presentations->isEmpty()) {
         $event->cancelled = true;
         $event->save();
     }
     $cancel = new CancelPresentation();
     $cancel->presentation_id = $presentation_id;
     $cancel->user_id = $user_id;
     $cancel->reason = $input['reason'];
     $cancel->duration = $input['duration'];
     $cancel->authorized = $input['authorized'];
     $cancel->date_refund = $input['date_refund'];
     $cancel->save();
     Session::flash('message', 'La presentación se ha cancelado!');
     Session::flash('alert-class', 'alert-success');
     return redirect('/promoter/presentation/cancelled');
 }
예제 #27
0
 public function store(StoreBookingRequest $request)
 {
     $event = Event::find($request['event_id']);
     $zone = Zone::find($request['zone_id']);
     $nTickets = $request['quantity'];
     $codigo_reserva = uniqid();
     $seats_array = array();
     if ($event->place->rows != null) {
         //Es numerado
         $seats = $request['seats'];
         $seats = $this->getSelectedSlots($seats, $zone->id);
         foreach ($seats as $seat_id) {
             $slot = DB::table('slot_presentation')->where('slot_id', $seat_id)->where('presentation_id', $request['presentation_id'])->first();
             array_push($seats_array, Slot::where('id', $seat_id)->get()->first());
             if ($slot->status != config('constants.seat_available')) {
                 return back()->withInput($request->except('seats'))->withErrors(['El asiento ' . $seat_id . ' no esta libre']);
             }
         }
     } else {
         //No es numerado
         $zoneXpres = DB::table('zone_presentation')->where('zone_id', $request['zone_id'])->where('presentation_id', $request['presentation_id'])->first();
         if ($zoneXpres->slots_availables - $nTickets < 0) {
             //Deberia ser zona x presentacion
             return back()->withInput($request->except('seats'))->withErrors(['La zona esta llena']);
         }
     }
     DB::beginTransaction();
     try {
         $tickets = array();
         for ($i = 0; $i < $nTickets; $i++) {
             if ($event->place->rows != null) {
                 //Cambiar estado de asiento
                 $seat = DB::table('slot_presentation')->where('slot_id', $seats[$i])->where('presentation_id', $request['presentation_id'])->sharedLock();
                 //Revisa de nuevo
                 $seat = DB::table('slot_presentation')->where('slot_id', $seats[$i])->where('presentation_id', $request['presentation_id'])->first();
                 if ($seat->status != config('constants.seat_available')) {
                     return back()->withInput($request->except('seats'))->withErrors(['El asiento ' . $seat_id . ' no esta libre']);
                 }
                 DB::table('slot_presentation')->where('slot_id', $seats[$i])->where('presentation_id', $request['presentation_id'])->update(['status' => config('constants.seat_reserved')]);
             } else {
                 //Disminuir capacidad en la zona de esa presentacion
                 DB::table('zone_presentation')->where('zone_id', $request['zone_id'])->where('presentation_id', $request['presentation_id'])->sharedLock();
                 $zoneXpres = DB::table('zone_presentation')->where('zone_id', $request['zone_id'])->where('presentation_id', $request['presentation_id'])->first();
                 if ($zoneXpres->slots_availables - $nTickets < 0) {
                     return back()->withInput($request->except('seats'))->withErrors(['La zona esta llena']);
                 }
                 DB::table('zone_presentation')->where('zone_id', $request['zone_id'])->where('presentation_id', $request['presentation_id'])->decrement('slots_availables');
             }
         }
         //Crear ticket
         $id = DB::table('tickets')->insertGetId(['payment_date' => null, 'reserve' => $codigo_reserva, 'cancelled' => 0, 'owner_id' => \Auth::user()->id, 'event_id' => $request['event_id'], 'price' => $zone->price, 'presentation_id' => $request['presentation_id'], 'zone_id' => $request['zone_id'], 'promo_id' => null, 'quantity' => $nTickets, 'salesman_id' => null, 'picked_up' => false, 'discount' => null, 'designee' => \Auth::user()->di, 'total_price' => $zone->price * $nTickets, 'created_at' => new Carbon(), 'updated_at' => new Carbon()]);
         if ($request['dni_recojo'] != null) {
             DB::table('tickets')->where('id', $id)->update(['designee' => $request['dni_recojo']]);
         }
         if ($event->place->rows != null) {
             //Asignar id en caso sea numerado
             for ($i = 0; $i < $nTickets; $i++) {
                 DB::table('slot_presentation')->where('slot_id', $seats[$i])->where('presentation_id', $request['presentation_id'])->update(['sale_id' => $id]);
             }
         }
         array_push($tickets, $id);
         DB::commit();
     } catch (\Exception $e) {
         //dd('rollback');
         DB::rollback();
         return back()->withInput($request->except('seats'))->withErrors(['Por favor intentelo nuevamente']);
     }
     $presentation = Presentation::find($request->input('presentation_id'));
     session(['tickets' => $tickets]);
     $array = ['event' => $event, 'zone' => $zone, 'cant' => $nTickets, 'eventDate' => date("d-m-Y h:i:s a", $presentation->starts_at), 'codigo' => $codigo_reserva, 'seats' => ''];
     if ($event->place->rows != null) {
         $array['seats'] = $seats_array;
     }
     return view('external.booking.results', $array);
     //return  $array['seats'][0]->row ;
 }
예제 #28
0
        </div>
    </div>
    <br>




    <div class="body-content">

        <div class="row">
            <div class="col-lg-12">

                <?php 
$idUser = Yii::$app->user->identity->id;
$event = Event::find()->where(['idUser' => $idUser])->orderBy('Date')->all();
if (count($event) == 0) {
    echo '<div class="col-lg-12 notEvent">У вас еще нет добавленных событий!</div>';
} else {
    echo '<table class="table table-striped">';
    echo '   <thead>';
    echo '   <tr>';
    echo '       <th>№</th>';
    echo '       <th>Событие</th>';
    echo '       <th>Дата</th>';
    echo '       <th>Удалить</th>';
    echo '   </tr>';
    echo '   </thead>';
}
echo '<tbody>';
for ($i = 0; $i < count($event); $i++) {
예제 #29
0
 public function postEdit(EventReq $req)
 {
     $event = Event::find($req->id);
     try {
         $event->fill($req->except('_token'));
         $event->save();
         return $this->edit('general', $event);
     } catch (InvalidModelException $e) {
         return redirect()->back()->withInput($req->except($req->dontFlash))->withErrors($e->getErrors(), 'default');
     }
 }
예제 #30
0
 /**
  * Delete a Vehicle of an Event.
  *
  * @param  VehicleRequest  $request
  * @param  int  $eid
  * @param  int  $vid
  * @return Response
  */
 public function destroy(VehicleRequest $request, $eid, $vid)
 {
     try {
         $user = $this->isEventManager($request, $eid);
         if (!$user) {
             return response()->error(403, 'You are not a manager of this event!');
         }
         $event = Event::find($eid);
         if (!$event) {
             return response()->error(404, 'Event Not Found');
         }
         $vehicle = EventVehicle::find($vid);
         if (!$vehicle) {
             return response()->error(404, 'Vehicle Not Found');
         }
         $vehicle->delete();
         return response()->success();
     } catch (Exception $e) {
         return response()->error();
     }
 }