Skip to content

NOW MANAGED ON CODEBERG

Adding getHeadingExcerpt to get heading.

Nilesh Deepak85fbe820c4d4
diff --git a/app/Book.php b/app/Book.php
index afec7a351..be90e0e1a 100644
--- a/app/Book.php
+++ b/app/Book.php
@@ -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');