laravel-connect/src/ConnectServiceProvider.php

70 lines
1.4 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:49:01 +02:00
use Bluesquare\Connect\View\Components\Button;
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'),
]);
$this->loadViewComponentsAs('connect', [
Button::class
]);
// Commands
if ($this->app->runningInConsole()) {
$this->commands([
Sync::class
]);
}
2020-05-11 16:26:34 +02:00
}
}