BookStack\Services\PermissionService::enforceChapterRestrictions PHP Метод

enforceChapterRestrictions() публичный Метод

Add on permission restrictions to a chapter query.
public enforceChapterRestrictions ( $query, string $action = 'view' ) : mixed
$query
$action string
Результат mixed
    public function enforceChapterRestrictions($query, $action = 'view')
    {
        return $this->enforceEntityRestrictions($query, $action);
    }

Usage Example

Пример #1
0
 /**
  * Get the latest chapters added to the system.
  * @param int $count
  * @param int $page
  * @param bool $additionalQuery
  * @return
  */
 public function getRecentlyCreatedChapters($count = 20, $page = 0, $additionalQuery = false)
 {
     $query = $this->permissionService->enforceChapterRestrictions($this->chapter)->orderBy('created_at', 'desc');
     if ($additionalQuery !== false && is_callable($additionalQuery)) {
         $additionalQuery($query);
     }
     return $query->skip($page * $count)->take($count)->get();
 }