public function getCategoryAttribute()
    {
        if(is_null($category = $this->categories->last())) {
            $category = new \stdClass();
            $category->title = 'No name';
            $category->slug = 'none';
            $category->alt_url = null;
            $category->template = null;
        }

        return $category;
    }
public function getCategoryAttribute()
    {
        if(is_null($category = $this->categories->last())) {
            $category = new \stdClass();
            $category->title = 'No name';
            $category->slug = 'none';
            $category->alt_url = null;
            $category->template = null;
        }

        return $category;
    }
public function getCategoryAttribute ( ) { if ( is_null ( $ category = $ this -> categories -> last ( ) ) ) { $ category = new \ stdClass ( ) ; $ category -> title = 'No name' ; $ category -> slug = 'none' ; $ category -> alt_url = null ; $ category -> template = null ; } return $ category ; }
Get a attributes to first category

@var array
Get a attributes to first category