Expanded chapters interface and improved book/page deletion

This commit is contained in:
Dan Brown
2015-07-28 20:57:13 +01:00
parent b9df3c647a
commit fd1a0dceb2
19 changed files with 282 additions and 141 deletions

View File

@ -53,10 +53,10 @@ class ChapterRepo
return $query->count() > 0;
}
public function findSuitableSlug($name, $bookId)
public function findSuitableSlug($name, $bookId, $currentId = false)
{
$slug = Str::slug($name);
while($this->doesSlugExist($slug, $bookId)) {
while($this->doesSlugExist($slug, $bookId, $currentId)) {
$slug .= '-' . substr(md5(rand(1, 500)), 0, 3);
}
return $slug;