¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -5,7 +5,6 @@ namespace Modules\Category\Services;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Cache;
use Modules\Category\Entities\Category;
class CategoryTreeUpdater
{
@@ -13,11 +12,12 @@ class CategoryTreeUpdater
* Update category tree order.
*
* @param array $tree
*
* @return void
*/
public static function update(array $tree)
{
list($ids, $parentIdCases, $positionCases, $params) = static::getDataForQuery($tree);
[$ids, $parentIdCases, $positionCases, $params] = static::getDataForQuery($tree);
$sql = "UPDATE `categories` SET
`parent_id` = CASE `id` {$parentIdCases} END,
@@ -30,10 +30,12 @@ class CategoryTreeUpdater
Cache::tags('categories')->flush();
}
/**
* Get data for update query.
*
* @param array $tree
*
* @return array
*/
private static function getDataForQuery(array $tree)
@@ -53,10 +55,12 @@ class CategoryTreeUpdater
return static::prepareData($ids, $cases, $params);
}
/**
* Get attributes list from given tree.
*
* @param array $tree
*
* @return array
*/
private static function getAttributesList(array $tree)
@@ -73,12 +77,14 @@ class CategoryTreeUpdater
return $attributes;
}
/**
* Prepare data for update query.
*
* @param array $ids
* @param array $cases
* @param array $params
*
* @return array
*/
private static function prepareData(array $ids, array $cases, array $params)