2017-12-14 12:28:58 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\Installer\Providers;
|
|
|
|
|
2019-11-27 22:19:20 +08:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2018-02-26 01:12:27 +08:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2017-12-14 12:28:58 +08:00
|
|
|
|
|
|
|
class InstallerServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Boot the application events.
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
$this->registerRoutes();
|
|
|
|
$this->registerTranslations();
|
|
|
|
$this->registerConfig();
|
|
|
|
$this->registerViews();
|
2019-11-27 22:19:20 +08:00
|
|
|
}
|
|
|
|
|
2017-12-14 12:28:58 +08:00
|
|
|
/**
|
|
|
|
* Register the routes
|
|
|
|
*/
|
|
|
|
protected function registerRoutes()
|
|
|
|
{
|
|
|
|
Route::group([
|
2019-08-27 00:32:46 +08:00
|
|
|
'as' => 'installer.',
|
|
|
|
'prefix' => 'install',
|
2017-12-14 12:28:58 +08:00
|
|
|
'middleware' => ['web'],
|
2019-08-27 00:32:46 +08:00
|
|
|
'namespace' => 'Modules\Installer\Http\Controllers',
|
|
|
|
], function () {
|
2019-12-13 04:07:35 +08:00
|
|
|
Route::get('/', 'InstallerController@index')->name('index');
|
|
|
|
Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest');
|
2017-12-14 12:42:45 +08:00
|
|
|
|
2019-12-13 04:07:35 +08:00
|
|
|
Route::get('/step1', 'InstallerController@step1')->name('step1');
|
|
|
|
Route::post('/step1', 'InstallerController@step1')->name('step1');
|
2019-11-27 22:19:20 +08:00
|
|
|
|
2019-12-13 04:07:35 +08:00
|
|
|
Route::get('/step2', 'InstallerController@step2')->name('step2');
|
|
|
|
Route::post('/envsetup', 'InstallerController@envsetup')->name('envsetup');
|
|
|
|
Route::get('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup');
|
|
|
|
|
|
|
|
Route::get('/step3', 'InstallerController@step3')->name('step3');
|
|
|
|
Route::post('/usersetup', 'InstallerController@usersetup')->name('usersetup');
|
|
|
|
|
|
|
|
Route::get('/complete', 'InstallerController@complete')->name('complete');
|
2019-11-27 22:19:20 +08:00
|
|
|
});
|
2017-12-14 12:28:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register config.
|
|
|
|
*/
|
|
|
|
protected function registerConfig()
|
|
|
|
{
|
2019-12-13 04:07:35 +08:00
|
|
|
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'installer');
|
2017-12-14 12:28:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register views.
|
|
|
|
*/
|
|
|
|
public function registerViews()
|
|
|
|
{
|
|
|
|
$viewPath = resource_path('views/modules/installer');
|
|
|
|
$sourcePath = __DIR__.'/../Resources/views';
|
|
|
|
|
|
|
|
$this->publishes([
|
2019-08-27 00:32:46 +08:00
|
|
|
$sourcePath => $viewPath,
|
|
|
|
], 'views');
|
2017-12-14 12:28:58 +08:00
|
|
|
|
2018-08-27 02:50:08 +08:00
|
|
|
$paths = array_map(
|
|
|
|
function ($path) {
|
|
|
|
return $path.'/modules/installer';
|
|
|
|
},
|
|
|
|
\Config::get('view.paths')
|
|
|
|
);
|
|
|
|
|
|
|
|
$paths[] = $sourcePath;
|
|
|
|
$this->loadViewsFrom($paths, 'installer');
|
2017-12-14 12:28:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register translations.
|
|
|
|
*/
|
|
|
|
public function registerTranslations()
|
|
|
|
{
|
|
|
|
$langPath = resource_path('lang/modules/installer');
|
|
|
|
|
|
|
|
if (is_dir($langPath)) {
|
|
|
|
$this->loadTranslationsFrom($langPath, 'installer');
|
|
|
|
} else {
|
2019-08-27 00:32:46 +08:00
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'installer');
|
2017-12-14 12:28:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the services provided by the provider.
|
|
|
|
*/
|
2018-08-27 02:50:08 +08:00
|
|
|
public function provides(): array
|
2017-12-14 12:28:58 +08:00
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|