active visible on shelves
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use App\Repositories\Core\Arrays;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class Categories
|
||||
{
|
||||
@@ -15,6 +16,12 @@ class Categories
|
||||
return $categories;
|
||||
}
|
||||
|
||||
public static function getTreeVisibles($withFolder = false)
|
||||
{
|
||||
$categories = self::getCategoryTreeVisibles()->toArray();
|
||||
return self::getChildren($categories[0]['children'], $withFolder);
|
||||
}
|
||||
|
||||
public static function getTree($withFolder = false)
|
||||
{
|
||||
$categories = self::getCategoryTree()->toArray();
|
||||
@@ -26,6 +33,11 @@ class Categories
|
||||
return self::getModel()->defaultOrder()->get()->toTree();
|
||||
}
|
||||
|
||||
public static function getCategoryTreeVisibles()
|
||||
{
|
||||
return self::getModel()->defaultOrder()->where('visible', 1)->get()->toTree();
|
||||
}
|
||||
|
||||
public static function getChildren($data, $withFolder = false)
|
||||
{
|
||||
$tree = [];
|
||||
@@ -98,6 +110,7 @@ class Categories
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
// return Category::class;
|
||||
return app('rinvex.categories.category');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Categories
|
||||
|
||||
public static function getTreeVisibles()
|
||||
{
|
||||
$tree = Category::get()->toTree();
|
||||
return CategoryTrees::getTreeVisibles();
|
||||
}
|
||||
|
||||
public static function getTree()
|
||||
|
||||
Reference in New Issue
Block a user