change display on categories
This commit is contained in:
@@ -8,6 +8,21 @@ use App\Repositories\Core\Categories as CategoryTrees;
|
||||
|
||||
class Categories
|
||||
{
|
||||
public static function getAncestorsByArticle($id)
|
||||
{
|
||||
$category = Articles::get($id)->categories()->first();
|
||||
$ancestors = self::getAncestorsByCategory($category->id);
|
||||
$ancestors[] = $category->toArray();
|
||||
return $ancestors;
|
||||
}
|
||||
|
||||
public static function getAncestorsByCategory($id)
|
||||
{
|
||||
$category = self::get($id);
|
||||
$ancestors = $category->getAncestors()->toArray();
|
||||
unset($ancestors[0]);
|
||||
return $ancestors;
|
||||
}
|
||||
|
||||
public static function getByHomepage()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user