Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $tags = ['Health', 'Technology', 'Education', 'Social', 'Conference', 'Sports', 'Fun', 'Christmas', 'Support', 'Life'];
     foreach ($tags as $tag_name) {
         $tag = new \Interested\Tag();
         $tag->name = $tag_name;
         $tag->save();
     }
 }
Пример #2
0
 /**
  * Updates the Events
  * Responds to requests to GET /update/event/{id}
  */
 public function getUpdateEvent($id)
 {
     $event_id = \Interested\Event::where('user_id', '=', \Auth::id())->with('tags')->find($id);
     if (is_null($event_id)) {
         \Session::flash('flash_message', 'Event is not present or not owned by the user.');
         return redirect('\\organizers');
     } else {
         # Get all the possible tags so we can include them with checkboxes in the view
         $tagModel = new \Interested\Tag();
         $tags_for_checkbox = $tagModel->getTagsForCheckboxes();
         /*
         Create a simple array of just the tag names for tags associated with this book;
         will be used in the view to decide which tags should be checked off
         */
         $tags_for_this_event = [];
         foreach ($event_id->tags as $tag) {
             $tags_for_this_event[] = $tag->name;
         }
         return view('events.edit')->with(['event' => $event_id, 'tags_for_checkbox' => $tags_for_checkbox, 'tags_for_this_event' => $tags_for_this_event]);
     }
 }