58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Album;
|
|
use App\Helpers\ConfigHelper;
|
|
use App\Helpers\ImageHelper;
|
|
use App\Helpers\ThemeHelper;
|
|
use App\Helpers\ValidationHelper;
|
|
use App\ModelObservers\AlbumObserver;
|
|
use Illuminate\Database\QueryException;
|
|
use Illuminate\Mail\Mailer;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
$this->app->singleton('image', function ($app)
|
|
{
|
|
return new ImageHelper();
|
|
});
|
|
$this->app->singleton('theme', function ($app)
|
|
{
|
|
return new ThemeHelper();
|
|
});
|
|
$this->app->singleton('user_config', function ($app)
|
|
{
|
|
return new ConfigHelper();
|
|
});
|
|
|
|
Validator::extend('is_dir', (ValidationHelper::class . '@directoryExists'));
|
|
Validator::extend('dir_empty', (ValidationHelper::class . '@isDirectoryEmpty'));
|
|
Validator::extend('is_writeable', (ValidationHelper::class . '@isPathWriteable'));
|
|
|
|
// Model observers
|
|
Album::observe(AlbumObserver::class);
|
|
}
|
|
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
}
|