use BookStack\Chapter;
use BookStack\Entity;
use BookStack\Exceptions\NotFoundException;
-use BookStack\Services\FileService;
+use BookStack\Services\AttachmentService;
use Carbon\Carbon;
use DOMDocument;
use DOMXPath;
*/
public function findSuitableSlug($name, $bookId, $currentId = false)
{
- $slug = Str::slug($name);
- if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5);
+ $slug = $this->nameToSlug($name);
while ($this->doesSlugExist($slug, $bookId, $currentId)) {
$slug .= '-' . substr(md5(rand(1, 500)), 0, 3);
}
$this->permissionService->deleteJointPermissionsForEntity($page);
// Delete AttachedFiles
- $fileService = app(FileService::class);
- foreach ($page->files as $file) {
- $fileService->deleteFile($file);
+ $attachmentService = app(AttachmentService::class);
+ foreach ($page->attachments as $attachment) {
+ $attachmentService->deleteFile($attachment);
}
$page->delete();
/**
* Get the latest pages added to the system.
* @param $count
+ * @return mixed
*/
public function getRecentlyCreatedPaginated($count = 20)
{
/**
* Get the latest pages added to the system.
* @param $count
+ * @return mixed
*/
public function getRecentlyUpdatedPaginated($count = 20)
{