Adding getHeadingExcerpt to get heading.
This commit is contained in:
parent
3435dcc91e
commit
85fbe820c4
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue