laravel-connect/src/ConnectServiceProvider.php

72 lines
1.5 KiB
PHP
Raw Normal View History

2020-05-11 16:26:34 +02:00
<?php
namespace Bluesquare\Connect;
2020-05-12 15:57:23 +02:00
use Bluesquare\Connect\Commands\Sync;
2020-05-11 16:26:34 +02:00
use Illuminate\Support\ServiceProvider;
class ConnectServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
2020-05-12 15:57:23 +02:00
// Config
2020-05-11 16:26:34 +02:00
$this->mergeConfigFrom(
__DIR__ . '/../config/bconnect.php',
2020-05-12 15:57:23 +02:00
'bconnect'
2020-05-11 16:26:34 +02:00
);
2020-05-12 15:57:23 +02:00
// Singletons
2020-05-11 16:26:34 +02:00
$this->app->singleton(Connect::class, function ($app) {
return new Connect($app);
});
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
2020-05-12 15:57:23 +02:00
// Config
2020-05-11 16:26:34 +02:00
$this->publishes([
__DIR__ . '/../config/bconnect.php' => config_path('bconnect.php')
2020-05-12 15:57:23 +02:00
]);
2020-05-12 18:54:56 +02:00
// Translations
$this->loadTranslationsFrom(__DIR__.'/../resources/translations', 'connect');
2020-05-12 15:57:23 +02:00
// Views
$this->loadViewsFrom(__DIR__.'/../resources/views/connect', 'connect');
$this->publishes([
__DIR__.'/../resources/views/connect' => resource_path('views/vendor/connect'),
]);
2020-05-13 13:15:20 +02:00
if (method_exists($this, 'loadViewComponentsAs')) {
// Laravel 7+
$this->loadViewComponentsAs('connect', [
\Bluesquare\Connect\View\Components\Button::class
]);
}
2020-05-12 15:57:23 +02:00
// Commands
if ($this->app->runningInConsole()) {
$this->commands([
Sync::class
]);
}
2020-05-11 16:26:34 +02:00
}
}