File: D:/HostingSpaces/debout/debout.nl/vendor/komma/kms/src/Providers/KmsServiceProvider.php
<?php namespace Komma\KMS\Providers;
use Komma\KMS\Console\Commands\CoreSeed;
use Komma\KMS\Globalization\UpdateServices\WebScraper;
use Komma\KMS\Globalization\UpdateServices\UpdateServiceInterface;
use Komma\KMS\Auth\AuthMailService;
use Komma\KMS\Auth\AuthMailServiceInterface;
use Komma\KMS\Documents\Kms\DocumentService;
use Komma\KMS\Documents\Kms\DocumentServiceInterface;
use Komma\KMS\ArtisanCommands\UpdateGlobalisationData;
use Komma\KMS\Core\AttributeDataService;
use Komma\KMS\Core\AttributeDataServiceInterface;
use Komma\KMS\Core\ModelService;
use Komma\KMS\Core\ModelServiceInterface;
use Komma\KMS\Core\RelatedModelService;
use Komma\KMS\Core\RelatedModelServiceInterface;
use Komma\KMS\Core\TranslationService;
use Komma\KMS\Core\TranslationServiceInterface;
use Komma\KMS\Core\Tree\TreeService;
use Komma\KMS\Core\Tree\TreeServiceInterface;
use Komma\KMS\ImageProcessing\CropperInterface;
use Komma\KMS\ImageProcessing\InterventionImageCropperBridge;
use Komma\KMS\Composers\FlashMessagesComposer;
use Komma\KMS\Composers\SidebarMenuComposer;
use Komma\KMS\Core\Attributes\Models\SelectOption;
use Komma\KMS\Core\Attributes\Models\SelectOptionInterface;
use Komma\KMS\Transfer\AbstractCsvExportService;
use Komma\KMS\Transfer\AbstractCsvImportService;
use Komma\KMS\Transfer\AbstractFolderImporterService;
use Illuminate\Support\ServiceProvider;
use Komma\KMS\Sites\Kms\SiteService;
use Komma\KMS\Sites\Models\Site;
use Komma\KMS\Sites\Models\SiteInterface;
use Komma\KMS\Sites\SiteServiceInterface;
class KmsServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->bootViewComposers();
$this->bootValidators();
$this->registerCommands();
// $this->setupExtraDuskTools();
}
/**
* Register artisan shop commands
*/
public function registerCommands()
{
$this->commands([
//Test / benchmark commands
UpdateGlobalisationData::class,
CoreSeed::class
]);
}
public function registerHelpers()
{
$file = __DIR__ . DIRECTORY_SEPARATOR .DIRECTORY_SEPARATOR.'Helpers'.DIRECTORY_SEPARATOR.'GlobalHelpers.php';
if (file_exists($file)) require_once($file);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerHelpers();
$this->app->bind(CropperInterface::class, InterventionImageCropperBridge::class);
$this->app->singleton(SiteServiceInterface::class, SiteService::class);
//Core model handling services
$this->app->bind(ModelServiceInterface::class, ModelService::class);
$this->app->bind(TranslationServiceInterface::class, TranslationService::class);
$this->app->bind(DocumentServiceInterface::class, DocumentService::class);
$this->app->bind(RelatedModelServiceInterface::class, RelatedModelService::class);
$this->app->bind(AttributeDataServiceInterface::class, AttributeDataService::class);
$this->app->bind(TreeServiceInterface::class, TreeService::class);
//Extensible model interface bindings.
$this->app->bind(SiteInterface::class, Site::class);
//Transfer handling services
//Examples on how to implement specific transfer handling services.
$this->app->bind(AbstractCsvImportService::class, function() {
throw new \Exception('Please build an implementation of '.AbstractCsvImportService::class.' and bind it in KmsServiceProvider to enable import functionality');
});
$this->app->bind(AbstractCsvExportService::class, function() {
throw new \Exception('Please build an implementation of '.AbstractCsvExportService::class.' and bind it in KmsServiceProvider to enable export functionality');
});
$this->app->bind(AbstractFolderImporterService::class, function() {
throw new \Exception('Please build an implementation of '.AbstractFolderImporterService::class.' and bind it in KmsServiceProvider to enable document import functionality');
});
//Core helper services
// $this->app->bind(ComponentableServiceInterface::class, ComponentableService::class); //TODO. I think this implementation became obsolete
$this->app->bind(AuthMailServiceInterface::class, AuthMailService::class);
$this->app->bind(SelectOptionInterface::class, SelectOption::class);
//Bind ther service that should be used for updating globalisation (g11n) data
$this->app->bind(UpdateServiceInterface::class, WebScraper::class);
}
protected function bootViewComposers()
{
$this->app->view->composer('KMS::kms/partials.sidebar', SidebarMenuComposer::class);
$this->app->view->composer('KMS::kms/partials.flashMessage', FlashMessagesComposer::class);
}
protected function bootValidators()
{
\Validator::extend('csv', 'App\Kms\Core\Validators\Validator@csv');
}
}