public function show($id)
 {
     $events = Events::findOrFail($id);
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('Events.show', compact('events'))->with('event_active', 'active')->with('data', $data);
 }
예제 #2
0
 /**
  * Update the specified event in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $event = Events::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Events::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $event->update($data);
     return Redirect::route('events.index');
 }
예제 #3
0
 /**
  *  View for Edit Event
  *  @return View
  */
 public function getEditEvent($id)
 {
     try {
         $event = \Events::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         throw new \EventNotFoundException();
     }
     $emaillist = null;
     //Get the user id of the currently logged in user
     $userId = \Sentry::getUser()->id;
     //Check Permission
     $checkpermission = $this->event->checkPermission($id, $userId);
     if ($checkpermission) {
         //Authorized, Get Event
         $event = $this->event->getEvent($id);
         foreach ($event['users'] as $user) {
             if ($emaillist == null) {
                 $emaillist = $user['email'];
             } else {
                 $emaillist = $emaillist . ',' . $user['email'];
             }
         }
         //Wrap Up and generate View
         return \View::make('dashboard.calendar.edit')->with('emaillist', $emaillist)->with('event', $event);
     } else {
         throw new \NotAuthorizedForEventException();
     }
 }
예제 #4
0
 public function getDeleteEvent($id)
 {
     $del = Events::findOrFail($id);
     $check = File::delete('uploads/events/' . $del->img);
     $name = $del->name;
     $del->delete();
     Session::flash('message', "ลบ " . $name . " สำเร็จ!!");
     return Redirect::to('/admin/events/manage');
 }