1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Made chapters functional and cleaned design features

This commit is contained in:
Dan Brown
2015-07-30 22:27:35 +01:00
parent fd1a0dceb2
commit b54ef3bb4b
21 changed files with 330 additions and 245 deletions

View File

@ -12,7 +12,7 @@ class Chapter extends Model
return $this->belongsTo('Oxbow\Book');
}
public function children()
public function pages()
{
return $this->hasMany('Oxbow\Page')->orderBy('priority', 'ASC');
}
@ -22,4 +22,9 @@ class Chapter extends Model
return '/books/' . $this->book->slug . '/chapter/' . $this->slug;
}
public function getExcerpt($length = 100)
{
return strlen($this->description) > $length ? substr($this->description, 0, $length-3) . '...' : $this->description;
}
}