56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Bluesquare\Connect;
|
|
|
|
use Bluesquare\Connect\Commands\RefreshTokens;
|
|
use Bluesquare\Connect\Commands\Sync;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class ConnectServiceProvider extends ServiceProvider
|
|
{
|
|
public function register()
|
|
{
|
|
$this->mergeConfigFrom($this->path('src/config/bconnect.php'), 'bconnect');
|
|
|
|
$this->app->singleton(Connect::class, function ($app) {
|
|
return new Connect($app);
|
|
});
|
|
}
|
|
|
|
public function boot()
|
|
{
|
|
$config_path = $this->path('src/config/bconnect.php');
|
|
$views_path = $this->path('resources/views/connect');
|
|
|
|
$this->publishes([
|
|
$config_path => config_path('bconnect.php'),
|
|
$views_path => resource_path('views/vendor/connect'),
|
|
]);
|
|
|
|
$this->loadTranslationsFrom($this->path('resources/translations'), 'connect');
|
|
|
|
$this->loadViewsFrom($this->path('resources/views/connect'), 'connect');
|
|
|
|
if ($this->app->runningInConsole()) {
|
|
$this->commands([
|
|
RefreshTokens::class,
|
|
Sync::class,
|
|
]);
|
|
}
|
|
|
|
// Laravel 7+
|
|
if (method_exists($this, 'loadViewComponentsAs')) {
|
|
$this->loadViewComponentsAs('connect', [
|
|
\Bluesquare\Connect\View\Components\Button::class
|
|
]);
|
|
}
|
|
}
|
|
|
|
// Misc
|
|
|
|
private function path($path = '')
|
|
{
|
|
return __DIR__ . "/../../$path";
|
|
}
|
|
}
|