app->scoped(StoicSettings::class); } public function boot(): void { Telemetry::optOut(); // header.blade.php's category dropdown — root collections of the catalog // group only, so merchandising groups (e.g. "Homepage") stay out of the // nav. Resolved per-request so the composer runs after `locale` middleware // has already set App::getLocale(), which CollectionService's name // resolution depends on. The group is looked up by handle, not id, since // ids can differ between environments. View::composer('components.header', function (ViewInstance $view) { $groupId = CollectionGroup::where('handle', 'shopify')->value('id'); $view->with('categories', $groupId === null ? [] : app(CollectionService::class)->list( filters: new CollectionFilters(groupId: $groupId, rootOnly: true), perPage: 100, sort: CollectionSort::Position, )->items()); }); // Site-wide settings edited in Stoic (settings.md): default meta // description, social links for the footer, emails and schema.org. View::composer( ['layouts.app', 'components.footer', 'emails.layout', 'home'], fn (ViewInstance $view) => $view->with('stoicSettings', app(StoicSettings::class)), ); // INTERIM, belongs in boboko-core's Store module: the sender name on // outgoing emails comes from Store Details' "Mail from name", with // MAIL_FROM_NAME as the fallback when it's empty. Done per message // rather than by setting config at boot, so a long-running queue // worker picks up a changed name without a restart. Only the default // from address is renamed; a mailable with its own from is left alone. Event::listen(MessageSending::class, function (MessageSending $event) { $name = app(StoreDetailsService::class)->current()->mail_from_name; if (blank($name)) { return; } $defaultAddress = config('mail.from.address'); $event->message->from(...array_map( fn (Address $from) => $from->getAddress() === $defaultAddress ? new Address($from->getAddress(), $name) : $from, $event->message->getFrom(), )); }); if ($this->app->environment('production')) { URL::forceScheme('https'); } $this->app->booted(function () { ModelManifest::replace( \Lunar\Models\Contracts\Customer::class, Customer::class, ); $this->app['config']->set( 'auth.providers.staff.model', Staff::class, ); Relation::morphMap([ 'staff' => \Lunar\Admin\Models\Staff::class, ]); }); } }