Adding your own installers
Installing Strata runs a bunch of hooks to make sure everything is working as intended. You are also able to create your own hooks that can be triggered when you're installing Strata.
Do to, so you need to create a new installer class that extends Helix\Lego\Console\Commands\Install\Installers\Installer
1<?php 2 3namespace App\Console\Commands\Strata\Install\Installers; 4 5use Helix\Lego\Console\Commands\Install\Installers\Installer; 6 7class Inspire extends Installer 8{ 9 public function description() : string10 {11 return 'Inspiring you to do great work';12 }13 14 public function run()15 {16 $this->info('You got this!');17 }18}
Now register your install with you Strata config file (config/lego.php
).
1<?php2 3return [4 // ...5 'installers' => [ 6 App\Console\Commands\Strata\Install\Installers\Inspire::class,7 ]8];
Run a installer before or after an existing installer
Sometimes the order of when an installer ran is important, for this you can tell Strata when the installer should run. Either use the public static string $before
or public static string $after
If you want it to run before the Strata installs the sites then tell it to.
1<?php 2 3namespace App\Console\Commands\Strata\Install\Installers; 4 5use Helix\Lego\Console\Commands\Install\Installers\InstallSites; 6use Helix\Lego\Console\Commands\Install\Installers\Installer; 7 8class Inspire extends Installer 9{10 public static string $before = InstallSites::class; 11 12 public function description() : string13 {14 return 'Inspiring you to do great work';15 }16 17 public function run()18 {19 $this->info('You got this!');20 }21}
Installers, Checkers, and Pre-Installers
This also works with Checkers and Pre-Installers. Checkers need to extend Helix\Lego\Console\Commands\Install\Checks\Checker
.
Remember to also register them in the Strata config.
1<?php 2 3return [ 4 // ... 5 'installers' => [ 6 // .. 7 ], 8 'checkers' => [ 9 // Add checkers here10 ],11 'preInstallers' => [12 // Add pre-installers here13 ],14];
Pre-Installers are the same as Installers, but these run before the Checkers.