public function run()
 {
     $categories = array(array('Service', 'Any service events that receives service hours should be tagged as Community Service (CO), but depending on the nature of the service event, the event can be tagged with the other Service tags (CA, CS, DSI, ISI).'), array('Leadership', 'Any event related to the operation of the club should be tagged as Administrative (AD). Examples of administrative events include but are not limited to attending meetings (e.g. general meetings, board meetings, committee meetings, Kiwanis meetings), tabling, and workshops.'), array('Fellowship', 'Any event in which club members are socially interacting with one another should be tagged as Social (SE). A social event promotes the morale of members so it is usually tagged as Membership Development & Education (MD); however, remember that although all SE events are MD-tagged, not all MD events are SE-tagged (e.g. workshops).'), array('Miscellaneous', 'Miscellaneous tags are supplementary. Remember that all events have to fall in one of the tags in the Service, Leadership, or Fellowship categories before getting a supplementary miscellaneous tag.'));
     foreach ($categories as $category) {
         EventCategory::create(array('name' => $category[0], 'description' => $category[1]));
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     $cerf = Cerf::find($id);
     if (!(Auth::user()->hasRole('Officer') || Auth::user()->hasRole('Administrator') || Auth::id() === $cerf->user_id)) {
         redirect()->action('CerfsController@overview');
     }
     $activities = Activity::where('cerf_id', $cerf->id)->get();
     $kiwanisAttendees = KiwanisAttendee::where('cerf_id', $cerf->id)->get();
     $serviceHoursSum = $activities->sum('service_hours') + $activities->sum('planning_hours') + $activities->sum('traveling_hours');
     $adminHoursSum = $activities->sum('admin_hours');
     $socialHoursSum = $activities->sum('social_hours');
     $event = $cerf->event;
     $tagCategories = [];
     for ($index = 1; $index <= 4; $index++) {
         $currentTags = [];
         $tags = $event->tags()->where('cerf_id', $cerf->id)->where('category_id', $index)->get();
         foreach ($tags as $tag) {
             array_push($currentTags, $tag->name . ' (' . $tag->abbreviation . ')');
         }
         $tagCategories[EventCategory::find($index)->name] = $currentTags;
     }
     $drivers = [];
     foreach ($activities as $activity) {
         if ($activity->mileage > 0) {
             $drivers[$activity->name] = $activity->mileage;
         }
     }
     return view('pages.cerfs.show', compact('cerf', 'activities', 'kiwanisAttendees', 'serviceHoursSum', 'adminHoursSum', 'socialHoursSum', 'tagCategories', 'drivers'));
 }