diff --git a/Modules/Setting/Http/Controllers/SettingController.php b/Modules/Setting/Http/Controllers/SettingController.php index 617c65f9..158e88cc 100644 --- a/Modules/Setting/Http/Controllers/SettingController.php +++ b/Modules/Setting/Http/Controllers/SettingController.php @@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Log; use Modules\Setting\Entities\Setting; use Modules\Setting\Http\Requests\StoreSettingsRequest; +use Modules\Setting\Http\Requests\StoreSmtpSettingsRequest; class SettingController extends Controller { @@ -43,7 +44,7 @@ class SettingController extends Controller } - public function updateSmtp(Request $request) { + public function updateSmtp(StoreSmtpSettingsRequest $request) { $toReplace = array( 'MAIL_MAILER='.env('MAIL_HOST'), 'MAIL_HOST="'.env('MAIL_HOST').'"', diff --git a/Modules/Setting/Http/Requests/StoreSmtpSettingsRequest.php b/Modules/Setting/Http/Requests/StoreSmtpSettingsRequest.php new file mode 100644 index 00000000..0b491c36 --- /dev/null +++ b/Modules/Setting/Http/Requests/StoreSmtpSettingsRequest.php @@ -0,0 +1,38 @@ + 'required|string|max:50', + 'mail_host' => 'required|string|max:50', + 'mail_port' => 'required|numeric|max:50', + 'mail_username' => 'required|string|max:50', + 'mail_password' => 'required|string|max:50', + 'mail_encryption' => 'required|string|max:50', + 'mail_from_address' => 'required|string|max:50', + 'mail_from_name' => 'required|string|max:50', + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return Gate::allows('access_settings'); + } +} diff --git a/composer.json b/composer.json index 752f7238..885a3632 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "livewire/livewire": "^2.5", "milon/barcode": "^8.0", "nwidart/laravel-modules": "^8.2", + "rachidlaasri/laravel-installer": "^4.1", "realrashid/sweet-alert": "^4.0", "spatie/laravel-medialibrary": "^9.0.0", "spatie/laravel-permission": "^4.2", diff --git a/composer.lock b/composer.lock index 3de9cef9..bbadcb8a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "646db8c9d7e97562bbf1eacf7731e23e", + "content-hash": "4bc556a435bf57dea6c0c00fdc2000cf", "packages": [ { "name": "asm89/stack-cors", @@ -3622,6 +3622,70 @@ }, "time": "2021-04-10T16:23:39+00:00" }, + { + "name": "rachidlaasri/laravel-installer", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/rashidlaasri/LaravelInstaller.git", + "reference": "b751b4c23dba893e9a4a12f881a6fd8fa921d228" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rashidlaasri/LaravelInstaller/zipball/b751b4c23dba893e9a4a12f881a6fd8fa921d228", + "reference": "b751b4c23dba893e9a4a12f881a6fd8fa921d228", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "RachidLaasri\\LaravelInstaller\\Providers\\LaravelInstallerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "RachidLaasri\\LaravelInstaller\\": "src/" + }, + "files": [ + "src/Helpers/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rachid Laasri", + "email": "rashidlaasri@gmail.com" + }, + { + "name": "Jeremy Kenedy", + "email": "jeremykenedy@gmail.com" + } + ], + "description": "Laravel web installer", + "support": { + "issues": "https://github.com/rashidlaasri/LaravelInstaller/issues", + "source": "https://github.com/rashidlaasri/LaravelInstaller/tree/4.1.0" + }, + "funding": [ + { + "url": "https://rachidlaasri.com", + "type": "custom" + }, + { + "url": "https://twitter.com/rashidlaasri", + "type": "custom" + } + ], + "time": "2020-05-19T13:19:45+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", diff --git a/config/app.php b/config/app.php index d81eeeed..769f5e09 100644 --- a/config/app.php +++ b/config/app.php @@ -169,6 +169,7 @@ return [ Spatie\Permission\PermissionServiceProvider::class, Milon\Barcode\BarcodeServiceProvider::class, Barryvdh\Snappy\ServiceProvider::class, + RachidLaasri\LaravelInstaller\Providers\LaravelInstallerServiceProvider::class, /* * Application Service Providers... */ diff --git a/resources/lang/en/installer_messages.php b/resources/lang/en/installer_messages.php new file mode 100644 index 00000000..04718332 --- /dev/null +++ b/resources/lang/en/installer_messages.php @@ -0,0 +1,247 @@ + 'Laravel Installer', + 'next' => 'Next Step', + 'back' => 'Previous', + 'finish' => 'Install', + 'forms' => [ + 'errorTitle' => 'The Following errors occurred:', + ], + + /* + * + * Home page translations. + * + */ + 'welcome' => [ + 'templateTitle' => 'Welcome', + 'title' => 'Laravel Installer', + 'message' => 'Easy Installation and Setup Wizard.', + 'next' => 'Check Requirements', + ], + + /* + * + * Requirements page translations. + * + */ + 'requirements' => [ + 'templateTitle' => 'Step 1 | Server Requirements', + 'title' => 'Server Requirements', + 'next' => 'Check Permissions', + ], + + /* + * + * Permissions page translations. + * + */ + 'permissions' => [ + 'templateTitle' => 'Step 2 | Permissions', + 'title' => 'Permissions', + 'next' => 'Configure Environment', + ], + + /* + * + * Environment page translations. + * + */ + 'environment' => [ + 'menu' => [ + 'templateTitle' => 'Step 3 | Environment Settings', + 'title' => 'Environment Settings', + 'desc' => 'Please select how you want to configure the apps .env file.', + 'wizard-button' => 'Form Wizard Setup', + 'classic-button' => 'Classic Text Editor', + ], + 'wizard' => [ + 'templateTitle' => 'Step 3 | Environment Settings | Guided Wizard', + 'title' => 'Guided .env Wizard', + 'tabs' => [ + 'environment' => 'Environment', + 'database' => 'Database', + 'application' => 'Application', + ], + 'form' => [ + 'name_required' => 'An environment name is required.', + 'app_name_label' => 'App Name', + 'app_name_placeholder' => 'App Name', + 'app_environment_label' => 'App Environment', + 'app_environment_label_local' => 'Local', + 'app_environment_label_developement' => 'Development', + 'app_environment_label_qa' => 'Qa', + 'app_environment_label_production' => 'Production', + 'app_environment_label_other' => 'Other', + 'app_environment_placeholder_other' => 'Enter your environment...', + 'app_debug_label' => 'App Debug', + 'app_debug_label_true' => 'True', + 'app_debug_label_false' => 'False', + 'app_log_level_label' => 'App Log Level', + 'app_log_level_label_debug' => 'debug', + 'app_log_level_label_info' => 'info', + 'app_log_level_label_notice' => 'notice', + 'app_log_level_label_warning' => 'warning', + 'app_log_level_label_error' => 'error', + 'app_log_level_label_critical' => 'critical', + 'app_log_level_label_alert' => 'alert', + 'app_log_level_label_emergency' => 'emergency', + 'app_url_label' => 'App Url', + 'app_url_placeholder' => 'App Url', + 'db_connection_failed' => 'Could not connect to the database.', + 'db_connection_label' => 'Database Connection', + 'db_connection_label_mysql' => 'mysql', + 'db_connection_label_sqlite' => 'sqlite', + 'db_connection_label_pgsql' => 'pgsql', + 'db_connection_label_sqlsrv' => 'sqlsrv', + 'db_host_label' => 'Database Host', + 'db_host_placeholder' => 'Database Host', + 'db_port_label' => 'Database Port', + 'db_port_placeholder' => 'Database Port', + 'db_name_label' => 'Database Name', + 'db_name_placeholder' => 'Database Name', + 'db_username_label' => 'Database User Name', + 'db_username_placeholder' => 'Database User Name', + 'db_password_label' => 'Database Password', + 'db_password_placeholder' => 'Database Password', + + 'app_tabs' => [ + 'more_info' => 'More Info', + 'broadcasting_title' => 'Broadcasting, Caching, Session, & Queue', + 'broadcasting_label' => 'Broadcast Driver', + 'broadcasting_placeholder' => 'Broadcast Driver', + 'cache_label' => 'Cache Driver', + 'cache_placeholder' => 'Cache Driver', + 'session_label' => 'Session Driver', + 'session_placeholder' => 'Session Driver', + 'queue_label' => 'Queue Driver', + 'queue_placeholder' => 'Queue Driver', + 'redis_label' => 'Redis Driver', + 'redis_host' => 'Redis Host', + 'redis_password' => 'Redis Password', + 'redis_port' => 'Redis Port', + + 'mail_label' => 'Mail', + 'mail_driver_label' => 'Mail Driver', + 'mail_driver_placeholder' => 'Mail Driver', + 'mail_host_label' => 'Mail Host', + 'mail_host_placeholder' => 'Mail Host', + 'mail_port_label' => 'Mail Port', + 'mail_port_placeholder' => 'Mail Port', + 'mail_username_label' => 'Mail Username', + 'mail_username_placeholder' => 'Mail Username', + 'mail_password_label' => 'Mail Password', + 'mail_password_placeholder' => 'Mail Password', + 'mail_encryption_label' => 'Mail Encryption', + 'mail_encryption_placeholder' => 'Mail Encryption', + + 'pusher_label' => 'Pusher', + 'pusher_app_id_label' => 'Pusher App Id', + 'pusher_app_id_palceholder' => 'Pusher App Id', + 'pusher_app_key_label' => 'Pusher App Key', + 'pusher_app_key_palceholder' => 'Pusher App Key', + 'pusher_app_secret_label' => 'Pusher App Secret', + 'pusher_app_secret_palceholder' => 'Pusher App Secret', + ], + 'buttons' => [ + 'setup_database' => 'Setup Database', + 'setup_application' => 'Setup Application', + 'install' => 'Install', + ], + ], + ], + 'classic' => [ + 'templateTitle' => 'Step 3 | Environment Settings | Classic Editor', + 'title' => 'Classic Environment Editor', + 'save' => 'Save .env', + 'back' => 'Use Form Wizard', + 'install' => 'Save and Install', + ], + 'success' => 'Your .env file settings have been saved.', + 'errors' => 'Unable to save the .env file, Please create it manually.', + ], + + 'install' => 'Install', + + /* + * + * Installed Log translations. + * + */ + 'installed' => [ + 'success_log_message' => 'Laravel Installer successfully INSTALLED on ', + ], + + /* + * + * Final page translations. + * + */ + 'final' => [ + 'title' => 'Installation Finished', + 'templateTitle' => 'Installation Finished', + 'finished' => 'Application has been successfully installed.', + 'migration' => 'Migration & Seed Console Output:', + 'console' => 'Application Console Output:', + 'log' => 'Installation Log Entry:', + 'env' => 'Final .env File:', + 'exit' => 'Click here to exit', + ], + + /* + * + * Update specific translations + * + */ + 'updater' => [ + /* + * + * Shared translations. + * + */ + 'title' => 'Laravel Updater', + + /* + * + * Welcome page translations for update feature. + * + */ + 'welcome' => [ + 'title' => 'Welcome To The Updater', + 'message' => 'Welcome to the update wizard.', + ], + + /* + * + * Welcome page translations for update feature. + * + */ + 'overview' => [ + 'title' => 'Overview', + 'message' => 'There is 1 update.|There are :number updates.', + 'install_updates' => 'Install Updates', + ], + + /* + * + * Final page translations. + * + */ + 'final' => [ + 'title' => 'Finished', + 'finished' => 'Application\'s database has been successfully updated.', + 'exit' => 'Click here to exit', + ], + + 'log' => [ + 'success_message' => 'Laravel Installer successfully UPDATED on ', + ], + ], +];