check(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'backup_file' => 'required|sql_gz' ]; } public function messages() { return [ 'backup_file.sql_gz' => 'Invalid file type, must be .gz file', ]; } protected function getValidatorInstance() { $validator = parent::getValidatorInstance(); $validator->addImplicitExtension('sql_gz', function($attribute, $value, $parameters) { if ($value) return $value->getClientOriginalExtension() == 'gz'; return false; }); return $validator; } }