mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 04:05:57 +00:00
Adding getHeadingExcerpt to get heading.
This commit is contained in:
parent
3435dcc91e
commit
85fbe820c4
@ -32,6 +32,12 @@ class Book extends Entity
|
||||
return $cover;
|
||||
}
|
||||
|
||||
public function getHeadingExcerpt($length = 35)
|
||||
{
|
||||
$heading = $this->name;
|
||||
return strlen($heading) > $length ? substr($heading, 0, $length-3) . '...' : $heading;
|
||||
}
|
||||
|
||||
public function cover()
|
||||
{
|
||||
return $this->belongsTo(Image::class, 'image');
|
||||
|
Loading…
Reference in New Issue
Block a user