package installer
This commit is contained in:
65
app/Providers/LaravelInstallerServiceProvider.php
Normal file
65
app/Providers/LaravelInstallerServiceProvider.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Http\Middleware\Installer\canInstall;
|
||||
use App\Http\Middleware\Installer\canUpdate;
|
||||
|
||||
|
||||
class LaravelInstallerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->publishFiles();
|
||||
$this->loadRoutesFrom(__DIR__.'/../../routes/web.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$router->middlewareGroup('install', [CanInstall::class]);
|
||||
$router->middlewareGroup('update', [CanUpdate::class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish config file for the installer.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function publishFiles()
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/../Config/installer.php' => base_path('config/installer.php'),
|
||||
], 'laravelinstaller');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/../assets' => public_path('installer'),
|
||||
], 'laravelinstaller');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/../Views' => base_path('resources/views/vendor/installer'),
|
||||
], 'laravelinstaller');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/../Lang' => base_path('resources/lang'),
|
||||
], 'laravelinstaller');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user