}
$pageContent = new PageContent($page);
- if (isset($input['markdown'])) {
+ if (!empty($input['markdown'] ?? '')) {
$pageContent->setNewMarkdown($input['markdown']);
} else {
$pageContent->setNewHTML($input['html']);
->where('page_id', '=', $page->id)
->orderBy('created_at', 'desc');
}
+ /**
+ * Get page details by chapter ID.
+ */
+ public function getPageByChapterID(int $id){
+ return Page::visible()->where('chapter_id', '=', $id)->get(['id','slug']);
+ }
}