Removed hasRole twig function
This commit is contained in:
@@ -66,18 +66,14 @@ class OrganisationsExtension extends AbstractExtension implements GlobalsInterfa
|
|||||||
return Capsule::table('organisation_members')
|
return Capsule::table('organisation_members')
|
||||||
->where('user_id', $currentUser->id)
|
->where('user_id', $currentUser->id)
|
||||||
->where('organisation_id', $organisation->id)
|
->where('organisation_id', $organisation->id)
|
||||||
->where('flag_admin', true)
|
|
||||||
->where('flag_approved', true)
|
->where('flag_approved', true)
|
||||||
|
->where('flag_admin', true)
|
||||||
->count() > 0;
|
->count() > 0;
|
||||||
}),
|
}),
|
||||||
new TwigFunction('isOrganisationRegistrant', function ($organisation) {
|
new TwigFunction('isOrganisationRegistrant', function ($organisation) {
|
||||||
$currentUser = $this->services->currentUser;
|
$currentUser = $this->services->currentUser;
|
||||||
return $organisation->registrant_id == $currentUser->id;
|
return $organisation->registrant_id == $currentUser->id;
|
||||||
}),
|
}),
|
||||||
new TwigFunction('hasRole', function ($roleSlug) {
|
|
||||||
$currentUser = $this->services->currentUser;
|
|
||||||
return $currentUser->roles()->where('slug', $roleSlug)->count() > 0;
|
|
||||||
}),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user