Пример #1
0
 /**
  * Generate the view for editing an event specified by $id.
  *
  * @param int $id
  * @return view editClubEventView
  */
 public function showEditEvent($id)
 {
     $event = ClubEvent::findOrFail($id);
     $schedule = $event->getSchedule()->getResults();
     $jobtypes = Jobtype::where('jbtyp_is_archived', '=', '0')->orderBy('jbtyp_title', 'ASC')->get();
     $places = Place::orderBy('plc_title', 'ASC')->lists('plc_title', 'id');
     $templates = Schedule::where('schdl_is_template', '=', '1')->orderBy('schdl_title', 'ASC')->get();
     $template = Schedule::where('id', '=', $schedule->id)->first();
     // put template data into entries
     $entries = $schedule->getEntries()->with('getJobType')->getResults();
     // put name of the active template for further use
     $activeTemplate = $template->schdl_title;
     return View::make('editClubEventView', compact('event', 'schedule', 'places', 'jobtypes', 'templates', 'template', 'entries', 'activeTemplate'));
 }
 /**
  * Updates all existing places with changes provided.
  *
  * @return view placeManagementView
  */
 public function updatePlaces()
 {
     $places = Place::orderBy('plc_title', 'ASC')->get();
     foreach ($places as $place) {
         if (Input::get('destroy' . $place->id)) {
             // find all schedules that use this place and replace it with a placeholder
             $filter = ClubEvent::where('plc_id', '=', $place->id)->get();
             foreach ($filter as $event) {
                 $event->plc_id = 0;
                 // placeholder with plc_title "-"
                 $event->save();
             }
             Place::destroy($place->id);
         } else {
             // update title
             $place->plc_title = Input::get('plc_title' . $place->id);
             $place->save();
         }
     }
     // need to update our index after the changes
     $places = Place::orderBy('plc_title', 'ASC')->get();
     return View::make('placeManagementView', compact('places'));
 }
Пример #3
0
 public function mostrar_lugar()
 {
     $lugares = Place::orderBy('lugar_nombre')->paginate(10);
     return View::make('lugar.listaLugar', array('lugares' => $lugares));
 }