A module class has two methods and the order matters:
final class Example extends Module
{
public function register(): void
{
$this->app->singleton('examples', fn () => new Services\Examples(
$this->app->make('db'),
));
}
public function boot(): void
{
$this->app->make('content_types')->register('example', [...]);
}
}Every module's register() runs before any module's boot(). So register() may not assume another module has done anything, and boot() may.
🚨 Widget areas must be registered in register(), not boot(). The widget module wires one listener per area during its own boot; an area registered in boot() is only picked up if your module happens to boot first, which is a bug that appears and disappears with unrelated changes.