BookStack\Repos\ChapterRepo::doesSlugExist PHP Method

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
    public function doesSlugExist($slug, $bookId, $currentId = false)
    {
        $query = $this->chapter->where('slug', '=', $slug)->where('book_id', '=', $bookId);
        if ($currentId) {
            $query = $query->where('id', '!=', $currentId);
        }
        return $query->count() > 0;
    }