jonnybarnes.uk/app/Providers/AppServiceProvider.php
Jonny Barnes fb44afd7ad Remove deprecated global helper functions (issue #99)
Squashed commit of the following:

commit 8ff29a8ab51ee5057ef786614ab95b005bf8918c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Feb 1 18:42:05 2019 +0000

    Replace deprecated global helpers with their facade equivalents
2019-02-01 18:49:35 +00:00

45 lines
1.1 KiB
PHP

<?php
namespace App\Providers;
use App\Models\Note;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Observers\NoteObserver;
use Laravel\Dusk\DuskServiceProvider;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Note::observe(NoteObserver::class);
// Request AS macro
Request::macro('wantsActivityStream', function () {
return Str::contains(mb_strtolower($this->header('Accept')), 'application/activity+json');
});
// configure Intervention/Image
$this->app->bind('Intervention\Image\ImageManager', function () {
return new \Intervention\Image\ImageManager(['driver' => config('image.driver')]);
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
}
}
}