user()->isAdmin(); } public function rules() { return [ 'start_date' => 'string|date', 'end_date' => 'string|date', 'date_key' => 'string', 'date_range' => 'sometimes|string', 'report_keys' => 'present|array', 'send_email' => 'required|bool', ]; } public function prepareForValidation() { $input = $this->all(); if(!array_key_exists('date_range', $input)) $input['date_range'] = 'all'; if(!array_key_exists('report_keys', $input)) $input['report_keys'] = []; if(!array_key_exists('send_email', $input)) $input['send_email'] = true; $this->replace($input); } }