]);
}
-
/**
* Build joint permissions for the given book and role combinations.
*/
/**
* @param Entity[] $entities
+ *
* @return SimpleEntityData[]
*/
protected function entitiesToSimpleEntities(array $entities): array
/**
* From the given entity list, provide back a mapping of entity types to
* the ids of that given type. The type used is the DB morph class.
+ *
* @param SimpleEntityData[] $entities
+ *
* @return array<string, int[]>
*/
protected function entitiesToTypeIdMap(array $entities): array
}
/**
- * Get the entity permissions for all the given entities
+ * Get the entity permissions for all the given entities.
+ *
* @param SimpleEntityData[] $entities
+ *
* @return EntityPermission[]
*/
protected function getEntityPermissionsForEntities(array $entities): array
$idsByType = $this->entitiesToTypeIdMap($entities);
$permissionFetch = EntityPermission::query()
->where('action', '=', 'view')
- ->where(function(Builder $query) use ($idsByType) {
+ ->where(function (Builder $query) use ($idsByType) {
foreach ($idsByType as $type => $ids) {
$query->orWhere(function (Builder $query) use ($type, $ids) {
$query->where('restrictable_type', '=', $type)->whereIn('restrictable_id', $ids);
'role_id' => $roleId,
];
}
-
-}
\ No newline at end of file
+}