diff --git a/app/Http/Requests/Setup/StoreSetupRequest.php b/app/Http/Requests/Setup/StoreSetupRequest.php index c7e0262433..13d37f2dab 100644 --- a/app/Http/Requests/Setup/StoreSetupRequest.php +++ b/app/Http/Requests/Setup/StoreSetupRequest.php @@ -27,31 +27,38 @@ class StoreSetupRequest extends Request public function rules() { - return [ - /*System*/ - 'url' => 'required', - /*Database*/ - 'db_host' => 'required', - 'db_database' => 'required', - 'db_username' => 'required', - 'db_password' => '', - /*Mail driver*/ - 'mail_driver' => 'required', - 'encryption' => 'required_unless:mail_driver,log', - 'mail_host' => 'required_unless:mail_driver,log', - 'mail_username' => 'required_unless:mail_driver,log', - 'mail_name' => 'required_unless:mail_driver,log', - 'mail_address' => 'required_unless:mail_driver,log', - 'mail_password' => 'required_unless:mail_driver,log', - /*user registration*/ - 'privacy_policy' => 'required', - 'terms_of_service' => 'required', - 'first_name' => 'required', - 'last_name' => 'required', - 'email' => 'required|email:rfc,dns', - 'password' => 'required', - ]; - } + $rules = [ + /*System*/ + 'url' => 'required', + /*Mail driver*/ + 'mail_driver' => 'required', + 'encryption' => 'required_unless:mail_driver,log', + 'mail_host' => 'required_unless:mail_driver,log', + 'mail_username' => 'required_unless:mail_driver,log', + 'mail_name' => 'required_unless:mail_driver,log', + 'mail_address' => 'required_unless:mail_driver,log', + 'mail_password' => 'required_unless:mail_driver,log', + /*user registration*/ + 'privacy_policy' => 'required', + 'terms_of_service' => 'required', + 'first_name' => 'required', + 'last_name' => 'required', + 'email' => 'required|email:rfc,dns', + 'password' => 'required', + ]; + + if ( ! config( 'ninja.preconfigured_install' ) ) { + $rules = array_merge( $rules, [ + /*Database*/ + 'db_host' => 'required', + 'db_database' => 'required', + 'db_username' => 'required', + 'db_password' => '', + ] ); + } + + return $rules; + } protected function prepareForValidation() {