PHP Class BookStack\Repos\ChapterRepo

Inheritance: extends EntityRepo
Datei anzeigen Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$pageRepo

Public Methods

Method Description
__construct ( PageRepo $pageRepo ) ChapterRepo constructor.
changeBook ( $bookId, Chapter $chapter, boolean $rebuildPermissions = false ) : Chapter Changes the book relation of this chapter.
createFromInput ( $input, Book $book ) : Chapter Create a new chapter from request input.
destroy ( Chapter $chapter ) Destroy a chapter and its relations by providing its slug.
doesSlugExist ( $slug, $bookId, boolean | false $currentId = false ) : boolean Check if a chapter's slug exists.
findSuitableSlug ( $name, $bookId, boolean | false $currentId = false ) : string Finds a suitable slug for the provided name.
getAll ( ) : Illuminate\Database\Eloquent\Collection | static[] Get all chapters.
getById ( $id ) : mixed Get a chapter by a specific id.
getBySearch ( string $term, array $whereTerms = [], integer $count = 20, array $paginationAppends = [] ) : mixed Get chapters by the given search term.
getBySlug ( $slug, $bookId ) : mixed Get a chapter that has the given slug within the given book.
getChildren ( Chapter $chapter ) Get the child items for a chapter
getNewPriority ( Chapter $chapter ) : integer Get a new priority value for a new page to be added to the given chapter.
idExists ( $id ) : boolean Check if an id exists.

Private Methods

Method Description
chapterQuery ( ) : mixed Base query for getting chapters, Takes permissions into account.

Method Details

__construct() public method

ChapterRepo constructor.
public __construct ( PageRepo $pageRepo )
$pageRepo PageRepo

changeBook() public method

Changes the book relation of this chapter.
public changeBook ( $bookId, Chapter $chapter, boolean $rebuildPermissions = false ) : Chapter
$bookId
$chapter BookStack\Chapter
$rebuildPermissions boolean
return BookStack\Chapter

createFromInput() public method

Create a new chapter from request input.
public createFromInput ( $input, Book $book ) : Chapter
$input
$book BookStack\Book
return BookStack\Chapter

destroy() public method

Destroy a chapter and its relations by providing its slug.
public destroy ( Chapter $chapter )
$chapter BookStack\Chapter

doesSlugExist() public method

Check if a chapter's slug exists.
public doesSlugExist ( $slug, $bookId, boolean | false $currentId = false ) : boolean
$slug
$bookId
$currentId boolean | false
return boolean

findSuitableSlug() public method

Checks database to prevent duplicate slugs.
public findSuitableSlug ( $name, $bookId, boolean | false $currentId = false ) : string
$name
$bookId
$currentId boolean | false
return string

getAll() public method

Get all chapters.
public getAll ( ) : Illuminate\Database\Eloquent\Collection | static[]
return Illuminate\Database\Eloquent\Collection | static[]

getById() public method

Get a chapter by a specific id.
public getById ( $id ) : mixed
$id
return mixed

getBySearch() public method

Get chapters by the given search term.
public getBySearch ( string $term, array $whereTerms = [], integer $count = 20, array $paginationAppends = [] ) : mixed
$term string
$whereTerms array
$count integer
$paginationAppends array
return mixed

getBySlug() public method

Get a chapter that has the given slug within the given book.
public getBySlug ( $slug, $bookId ) : mixed
$slug
$bookId
return mixed

getChildren() public method

Get the child items for a chapter
public getChildren ( Chapter $chapter )
$chapter BookStack\Chapter

getNewPriority() public method

Get a new priority value for a new page to be added to the given chapter.
public getNewPriority ( Chapter $chapter ) : integer
$chapter BookStack\Chapter
return integer

idExists() public method

Check if an id exists.
public idExists ( $id ) : boolean
$id
return boolean

Property Details

$pageRepo protected_oe property

protected $pageRepo