2016-09-01 16:23:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2017-04-17 21:31:45 +01:00
|
|
|
use App\Album;
|
2016-09-05 15:28:56 +01:00
|
|
|
use App\Helpers\ConfigHelper;
|
2016-09-03 17:09:49 +01:00
|
|
|
use App\Helpers\ImageHelper;
|
2016-09-02 10:42:05 +01:00
|
|
|
use App\Helpers\ThemeHelper;
|
2016-10-27 11:36:37 +01:00
|
|
|
use App\Helpers\ValidationHelper;
|
2017-04-17 21:31:45 +01:00
|
|
|
use App\ModelObservers\AlbumObserver;
|
2016-09-02 21:27:50 +01:00
|
|
|
use Illuminate\Database\QueryException;
|
2016-09-06 14:19:16 +01:00
|
|
|
use Illuminate\Mail\Mailer;
|
2017-04-19 08:52:05 +01:00
|
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
2016-09-21 12:10:37 +01:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2016-10-27 11:36:37 +01:00
|
|
|
use Illuminate\Support\Facades\Validator;
|
2016-09-02 10:42:05 +01:00
|
|
|
use Illuminate\Support\Facades\View;
|
2016-09-01 16:23:39 +01:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2017-04-19 08:52:05 +01:00
|
|
|
$themeHelper = new ThemeHelper();
|
|
|
|
|
2016-10-01 14:45:48 +01:00
|
|
|
$this->app->singleton('image', function ($app)
|
2016-09-03 17:09:49 +01:00
|
|
|
{
|
2016-10-01 14:45:48 +01:00
|
|
|
return new ImageHelper();
|
|
|
|
});
|
2017-04-19 08:52:05 +01:00
|
|
|
$this->app->singleton('theme', function ($app) use ($themeHelper)
|
2016-10-01 14:45:48 +01:00
|
|
|
{
|
2017-04-19 08:52:05 +01:00
|
|
|
return $themeHelper;
|
2016-10-01 14:45:48 +01:00
|
|
|
});
|
|
|
|
$this->app->singleton('user_config', function ($app)
|
|
|
|
{
|
|
|
|
return new ConfigHelper();
|
|
|
|
});
|
2016-10-27 11:36:37 +01:00
|
|
|
|
|
|
|
Validator::extend('is_dir', (ValidationHelper::class . '@directoryExists'));
|
|
|
|
Validator::extend('dir_empty', (ValidationHelper::class . '@isDirectoryEmpty'));
|
|
|
|
Validator::extend('is_writeable', (ValidationHelper::class . '@isPathWriteable'));
|
2017-04-17 21:31:45 +01:00
|
|
|
|
|
|
|
// Model observers
|
|
|
|
Album::observe(AlbumObserver::class);
|
2017-04-19 08:52:05 +01:00
|
|
|
|
|
|
|
// Configure our default pager
|
|
|
|
LengthAwarePaginator::defaultView($themeHelper->viewName('partials.pager_links'));
|
2016-09-01 16:23:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|