/**
  * Get the validation rules that apply to the request.
  * @return array
  */
 public function rules()
 {
     return Event::getValidationRules('name', 'em_id', 'type', 'description', 'venue', 'venue_type', 'client_type', 'date_start', RequestFacade::has('one_day') ? '' : 'date_end', 'time_start', 'time_end');
 }
 /**
  * Update the event's venue
  * @param \App\Http\Requests\GenericRequest $request
  * @param \App\Event                        $event
  * @return mixed
  */
 private function update_UpdateDetails(GenericRequest $request, Event $event)
 {
     // Check a field is specified
     $field = $request->get('field') ?: @key($request->except('_token'));
     $value = $request->get('value') ?: $request->get($field);
     if (!$field) {
         return $this->ajaxError('Invalid submission');
     }
     // Check if the field is the em id
     if ($field == 'em_id' && !$this->user->isAdmin()) {
         return $this->ajaxError('You need to be an admin to change the EM');
     }
     // Perform some checks on the value based on the event type
     if (!$event->isEvent() && in_array($field, ['client_type', 'venue_type'])) {
         $value = null;
     }
     // Validate
     $validator = Validator::make([$field => $value], Event::getValidationRules($field), Event::getValidationMessages($field));
     if ($validator->fails()) {
         if (!$request->get('field')) {
             $this->throwValidationException($request, $validator);
         } else {
             return $this->ajaxError($validator->messages()->first());
         }
     }
     // Send email if the EM has been set
     if ($field == 'em_id' && $value != $event->em_id && $value) {
         $user = User::find($value);
         Mail::queue('emails.events.new_em', ['event' => $event->name, 'event_id' => $event->id, 'user' => $user->forename], function ($message) use($user) {
             $message->to($user->email, $user->name)->subject('Volunteered to EM event');
         });
     }
     // Update
     $event->update([$field => $value]);
     if (!$request->get('field')) {
         Flash::success('Updated');
     }
     return Response::json(true);
 }