2016-05-19 15:01:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use App\Note;
|
2017-09-11 15:56:11 +01:00
|
|
|
use Illuminate\Http\Request;
|
2017-11-09 11:30:54 +00:00
|
|
|
use App\Observers\NoteObserver;
|
2017-02-18 12:27:21 +00:00
|
|
|
use Laravel\Dusk\DuskServiceProvider;
|
2016-05-19 15:01:28 +01:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2017-11-09 11:30:54 +00:00
|
|
|
Note::observe(NoteObserver::class);
|
2017-09-11 15:56:11 +01:00
|
|
|
|
|
|
|
// Request AS macro
|
2017-09-13 17:02:31 +00:00
|
|
|
Request::macro('wantsActivityStream', function () {
|
2017-09-11 15:56:11 +01:00
|
|
|
return str_contains(mb_strtolower($this->header('Accept')), 'application/activity+json');
|
|
|
|
});
|
2017-09-16 11:39:36 +01:00
|
|
|
|
|
|
|
// configure Intervention/Image
|
|
|
|
$this->app->bind('Intervention\Image\ImageManager', function () {
|
|
|
|
return new \Intervention\Image\ImageManager(['driver' => config('image.driver')]);
|
|
|
|
});
|
2016-05-19 15:01:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2017-02-18 12:27:21 +00:00
|
|
|
if ($this->app->environment('local', 'testing')) {
|
|
|
|
$this->app->register(DuskServiceProvider::class);
|
|
|
|
}
|
2016-05-19 15:01:28 +01:00
|
|
|
}
|
|
|
|
}
|