26 public function register()
28 $this->app->call([$this,
'registerAuthentication']);
29 $this->app->bind(ResourceIdGenerator::class, AuthenticationResourceIdGenerator::class);
30 $this->app->
register(PassportServiceProvider::class);
38 UrlGenerator::macro(
'getAuthQueryArray',
function() {
40 if(app(Authentication::class)->getUser() !== null) {
41 $query[
'u'] = app(Authentication::class)->getUser()->id();
43 if(app(Authentication::class)->getGroup() !== null) {
44 $query[
'g'] = app(Authentication::class)->getGroup()->id();
46 if(app(Authentication::class)->getRole() !== null) {
47 $query[
'r'] = app(Authentication::class)->getRole()->id();
50 $query[
'a'] = app(ActivityInstanceResolver::class)->getActivityInstance()->id;
54 UrlGenerator::macro(
'getAuthQueryString',
function() {
55 return http_build_query(UrlGenerator::getAuthQueryArray(),
'',
'&', PHP_QUERY_RFC3986);
61 $this->app->bind(Authentication::class,
function($app) use ($request) {
62 return ($request->is(
'api/*') ?
63 $app->make(ApiAuthentication::class) : $app->make(WebRequestAuthentication::class));
registerAuthentication(Request $request)