b2in/packages/acme/contact-form/src/ContactFormServiceProvider.php
2026-04-10 17:18:17 +02:00

44 lines
1.3 KiB
PHP

<?php
namespace Acme\ContactForm;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
class ContactFormServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(
__DIR__.'/../config/contact-form.php',
'contact-form'
);
$this->app->singleton(ContactFormService::class, function (): ContactFormService {
return new ContactFormService;
});
}
public function boot(): void
{
$this->loadViewsFrom(__DIR__.'/../resources/views', 'contact-form');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'contact-form');
Livewire::component('contact-form', \Acme\ContactForm\Livewire\ContactForm::class);
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/contact-form.php' => config_path('contact-form.php'),
], 'contact-form-config');
$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/contact-form'),
], 'contact-form-views');
$this->publishes([
__DIR__.'/../lang' => lang_path('vendor/contact-form'),
], 'contact-form-lang');
}
}
}