Chapters API: Added missing book_slug field

Was removed during previous changes, but reflected in response examples.
This adds into all standard single chapter responses.
For #4765
This commit is contained in:
Dan Brown
2024-01-16 12:06:13 +00:00
parent afbbcafd44
commit adf1806fea
4 changed files with 13 additions and 7 deletions

View File

@ -134,8 +134,9 @@ class ChapterApiController extends ApiController
$chapter->unsetRelations()->refresh();
$chapter->load(['tags']);
$chapter->makeVisible('description_html')
->setAttribute('description_html', $chapter->descriptionHtml());
$chapter->makeVisible('description_html');
$chapter->setAttribute('description_html', $chapter->descriptionHtml());
$chapter->setAttribute('book_slug', $chapter->book()->first()->slug);
return $chapter;
}