Add macro to determine if we are receiving a request for AS2.0 data
This commit is contained in:
parent
119908b1c2
commit
c576298f7a
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,7 @@ namespace App\Providers;
|
|||
use App\Tag;
|
||||
use App\Note;
|
||||
use Validator;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Dusk\DuskServiceProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
|
@ -46,6 +47,11 @@ class AppServiceProvider extends ServiceProvider
|
|||
$note->tags()->attach($tagsToAdd);
|
||||
}
|
||||
});
|
||||
|
||||
// Request AS macro
|
||||
Request::macro('wantsActivityStream', function() {
|
||||
return str_contains(mb_strtolower($this->header('Accept')), 'application/activity+json');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue