/**
  * Store a newly created resource in storage for approval.
  *
  * @return Response
  */
 public function collect(CollectRequest $request)
 {
     $data = $request->all();
     if ($request->user() && $request->user()->hasPermission('venues.admin')) {
         $data['visible'] = true;
     }
     Venue::create($data)->tags()->attach($request->tags);
     return redirect('venues.submit');
 }
 /**
  * Store a newly created resource in storage for approval.
  *
  * @return Response
  */
 public function collect(CollectRequest $request)
 {
     $data = $request->all();
     if ($request->user() && $request->user()->hasPermission('events.admin')) {
         $data['visible'] = true;
     }
     if (!$request->has('venue_id')) {
         $data['venue']['visible'] = true;
         $venue = Venue::firstOrCreate($data['venue']);
         $data['venue_id'] = $venue->id;
     }
     $event = Event::create($data);
     $event->tags()->attach($request->tags);
     if ($event) {
         $data = ['id' => $event->id, 'name' => $event->name, 'time' => $event->start_time->format('g:ia, m/d/Y') . (isset($event->end_time) ? ' - ' . $event->end_time->format('g:ia, m/d/Y') : ''), 'location' => isset($venue) ? $venue->name : Venue::find($event->venue_id)->name, 'facebook' => $event->facebook, 'description' => $event->description];
         Mail::send('emails.events.collect', $data, function ($message) {
             $message->from('*****@*****.**', 'Wichitasome!');
             $message->to('*****@*****.**')->subject('New Event!');
         });
     }
     return redirect('events/submit')->with('message', '<strong>Woo! A new event!</strong> Thanks, we\'ll look it over at get it listed ASAP.');
 }