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