Adding getHeadingExcerpt to get heading.

This commit is contained in:
Nilesh Deepak 2017-07-15 16:11:10 +05:30
parent 3435dcc91e
commit 85fbe820c4

View file

@ -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');