44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Note;
|
|
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);
|
|
}
|
|
}
|
|
}
|