LandingPageRepository
in package
Landing Page Repository
Handles database operations for landing pages and blocks
Table of Contents
Methods
- createBlock() : int
- Create new block
- createPage() : int
- Create new landing page
- createVersion() : int
- Create page version snapshot
- deleteBlock() : bool
- Delete block
- deletePage() : bool
- Delete landing page
- duplicateBlock() : int|null
- Duplicate block
- getAllBlockTypes() : Collection
- Get all block types
- getAllPages() : Collection
- Get all landing pages
- getAuditLog() : Collection
- Get audit log
- getBlockById() : object|null
- Get block by ID
- getBlockTypeById() : object|null
- Get block type by ID
- getBlockTypeByName() : object|null
- Get block type by machine name
- getChildBlocks() : Collection
- Get child blocks for a parent block
- getDefaultPage() : object|null
- Get default landing page
- getPageBlocks() : Collection
- Get all blocks for a page
- getPageById() : object|null
- Get page by ID
- getPageBySlug() : object|null
- Get page by slug
- getPageVersions() : Collection
- Get page versions
- logAudit() : void
- Log audit entry
- moveBlockToColumn() : bool
- Move block into a column
- reorderBlocks() : bool
- Reorder blocks on a page
- reorderColumnBlocks() : bool
- Reorder blocks within a column
- restoreVersion() : bool
- Restore version
- slugExists() : bool
- Check if slug exists
- updateBlock() : bool
- Update block
- updatePage() : bool
- Update landing page
Methods
createBlock()
Create new block
public
createBlock(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
Return values
intcreatePage()
Create new landing page
public
createPage(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
Return values
intcreateVersion()
Create page version snapshot
public
createVersion(int $pageId[, string $status = 'draft' ][, int|null $userId = null ][, string|null $notes = null ]) : int
Parameters
- $pageId : int
- $status : string = 'draft'
- $userId : int|null = null
- $notes : string|null = null
Return values
intdeleteBlock()
Delete block
public
deleteBlock(int $id) : bool
Parameters
- $id : int
Return values
booldeletePage()
Delete landing page
public
deletePage(int $id) : bool
Parameters
- $id : int
Return values
boolduplicateBlock()
Duplicate block
public
duplicateBlock(int $blockId) : int|null
Parameters
- $blockId : int
Return values
int|nullgetAllBlockTypes()
Get all block types
public
getAllBlockTypes([bool $activeOnly = true ]) : Collection
Parameters
- $activeOnly : bool = true
Return values
CollectiongetAllPages()
Get all landing pages
public
getAllPages([bool $activeOnly = false ]) : Collection
Parameters
- $activeOnly : bool = false
Return values
CollectiongetAuditLog()
Get audit log
public
getAuditLog([int|null $pageId = null ][, int $limit = 50 ]) : Collection
Parameters
- $pageId : int|null = null
- $limit : int = 50
Return values
CollectiongetBlockById()
Get block by ID
public
getBlockById(int $id) : object|null
Parameters
- $id : int
Return values
object|nullgetBlockTypeById()
Get block type by ID
public
getBlockTypeById(int $id) : object|null
Parameters
- $id : int
Return values
object|nullgetBlockTypeByName()
Get block type by machine name
public
getBlockTypeByName(string $machineName) : object|null
Parameters
- $machineName : string
Return values
object|nullgetChildBlocks()
Get child blocks for a parent block
public
getChildBlocks(int $parentBlockId) : Collection
Parameters
- $parentBlockId : int
Return values
CollectiongetDefaultPage()
Get default landing page
public
getDefaultPage() : object|null
Return values
object|nullgetPageBlocks()
Get all blocks for a page
public
getPageBlocks(int $pageId[, bool $visibleOnly = false ]) : Collection
Parameters
- $pageId : int
- $visibleOnly : bool = false
Return values
CollectiongetPageById()
Get page by ID
public
getPageById(int $id) : object|null
Parameters
- $id : int
Return values
object|nullgetPageBySlug()
Get page by slug
public
getPageBySlug(string $slug) : object|null
Parameters
- $slug : string
Return values
object|nullgetPageVersions()
Get page versions
public
getPageVersions(int $pageId[, int $limit = 10 ]) : Collection
Parameters
- $pageId : int
- $limit : int = 10
Return values
CollectionlogAudit()
Log audit entry
public
logAudit(string $action[, int|null $pageId = null ][, int|null $blockId = null ][, array<string|int, mixed>|null $details = null ][, int|null $userId = null ]) : void
Parameters
- $action : string
- $pageId : int|null = null
- $blockId : int|null = null
- $details : array<string|int, mixed>|null = null
- $userId : int|null = null
moveBlockToColumn()
Move block into a column
public
moveBlockToColumn(int $blockId, int|null $parentBlockId, string|null $columnSlot) : bool
Parameters
- $blockId : int
- $parentBlockId : int|null
- $columnSlot : string|null
Return values
boolreorderBlocks()
Reorder blocks on a page
public
reorderBlocks(int $pageId[, array<string|int, mixed>|null $order = null ]) : bool
Parameters
- $pageId : int
- $order : array<string|int, mixed>|null = null
Return values
boolreorderColumnBlocks()
Reorder blocks within a column
public
reorderColumnBlocks(int|null $parentBlockId, string|null $columnSlot, array<string|int, mixed> $order) : bool
Parameters
- $parentBlockId : int|null
- $columnSlot : string|null
- $order : array<string|int, mixed>
Return values
boolrestoreVersion()
Restore version
public
restoreVersion(int $versionId) : bool
Parameters
- $versionId : int
Return values
boolslugExists()
Check if slug exists
public
slugExists(string $slug[, int|null $excludeId = null ]) : bool
Parameters
- $slug : string
- $excludeId : int|null = null
Return values
boolupdateBlock()
Update block
public
updateBlock(int $id, array<string|int, mixed> $data) : bool
Parameters
- $id : int
- $data : array<string|int, mixed>
Return values
boolupdatePage()
Update landing page
public
updatePage(int $id, array<string|int, mixed> $data) : bool
Parameters
- $id : int
- $data : array<string|int, mixed>