A Laravel package to help you build a web setup wizard for your application
composer require kargolsan/laravel-install-wizard
'providers' => [
/**
* Other Service Providers
*/
Collective\Html\HtmlServiceProvider::class, // for laravelcollective/html require
KarGolSan\InstallWizard\ServiceProvider::class,
],
'aliases' => [
/**
* Other aliases
*/
'Form' => Collective\Html\FormFacade::class, // for laravelcollective/html require
'Html' => Collective\Html\HtmlFacade::class, // for laravelcollective/html require
'InstallWizard' => KarGolSan\InstallWizard\Facades\InstallWizard::class,
],
Add the following line to your app/Http/Kernel.php
file:
protected $middlewareGroups = [
// ...
// Other Middleware
// ...
'install_wizard' => [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
'install_wizard.initializer',
]
];
protected $routeMiddleware = [
// ...
// Other Middleware
// ...
'install_wizard.initializer' => \KarGolSan\InstallWizard\Middleware\InstallWizardInitializer::class,
'install_wizard.trigger' => \KarGolSan\InstallWizard\Middleware\InstallWizardTrigger::class,
];
If you want to launch the install wizard automatically when required, you need to add the SetupWizardTrigger
middleware
to the routes you wish to protect. For instance, if you have a route group to show an administration panel, you could
do it there:
Route::group([
'prefix' => 'admin',
'middleware' => 'install_wizard.trigger'
], function () {
// ...
});
This way, the setup wizard will only be triggered when trying to access the administration panel.