1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 15:42:41 +01:00
BookStack/app/Providers/AppServiceProvider.php

40 lines
1.1 KiB
PHP
Raw Normal View History

<?php namespace BookStack\Providers;
2015-07-12 21:01:42 +02:00
use BookStack\Services\SettingService;
use BookStack\Setting;
2015-07-12 21:01:42 +02:00
use Illuminate\Support\ServiceProvider;
2016-12-31 15:38:04 +01:00
use Validator;
2015-07-12 21:01:42 +02:00
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Custom validation methods
2016-12-31 15:38:04 +01:00
Validator::extend('is_image', function($attribute, $value, $parameters, $validator) {
$imageMimes = ['image/png', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/tiff', 'image/webp'];
return in_array($value->getMimeType(), $imageMimes);
});
\Blade::directive('icon', function($expression) {
return "<?php echo icon($expression); ?>";
});
2015-07-12 21:01:42 +02:00
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->singleton(SettingService::class, function($app) {
return new SettingService($app->make(Setting::class), $app->make('Illuminate\Contracts\Cache\Repository'));
});
2015-07-12 21:01:42 +02:00
}
}