public function getPostCountAttribute()
    {
    	if ( ! array_key_exists('postCount', $this->relations)) $this->load('postCount');
    
    	$related = $this->getRelation('postCount')->first();
    
    	return ($related) ? $related->aggregate : 0;
    }
public function getPostCountAttribute()
    {
    	if ( ! array_key_exists('postCount', $this->relations)) $this->load('postCount');
    
    	$related = $this->getRelation('postCount')->first();
    
    	return ($related) ? $related->aggregate : 0;
    }
public function getPostCountAttribute ( ) { if ( ! array_key_exists ( 'postCount' , $ this -> relations ) ) $ this -> load ( 'postCount' ) ; $ related = $ this -> getRelation ( 'postCount' ) -> first ( ) ; return ( $ related ) ? $ related -> aggregate : 0 ; }
accessor for easier fetching the count
accessor for easier fetching the count