EV3-415 Termék betöltése adminsztrációs felületen
This commit is contained in:
parent
ab76515822
commit
4b7db9fe00
@ -89,21 +89,25 @@ public function nodesWithParentToTree(array $nodesId)
|
||||
*/
|
||||
public function allWithParents($maxDepth = 999): array
|
||||
{
|
||||
// $productGroupArray=$this->with('ancestors')->get()->toArray();
|
||||
$productGroups = $this->withDepth()->with('ancestors')->get();
|
||||
|
||||
$productGroupArray = [];
|
||||
$productGroups = $this->withDepth()->get();
|
||||
foreach ($productGroups as $item) {
|
||||
if ($item->depth > $maxDepth) {
|
||||
continue;
|
||||
}
|
||||
$children = ProductGroup::descendantsOf($item);
|
||||
(count($children) > 0) ? $item->hasChild = true : $item->hasChild = false;
|
||||
$parents = ProductGroup::ancestorsOf($item);
|
||||
|
||||
$item->hasChild = ($item->_rgt - $item->_lft) > 1;
|
||||
|
||||
$parents = $item->ancestors;
|
||||
$parentNames = $parents->pluck('name')->toArray();
|
||||
|
||||
$item->parents = $parents->toArray();
|
||||
$item->parentsNames = ProductGroup::ancestorsOf($item)->pluck('name')->toArray();
|
||||
$item->parentsPath = implode('/', ProductGroup::ancestorsOf($item)->pluck('name')->toArray());
|
||||
$item->parentsIds = ProductGroup::ancestorsOf($item)->pluck('id')->toArray();
|
||||
$item->parentsIdPointer = implode('_', ProductGroup::ancestorsOf($item)->pluck('name')->toArray());
|
||||
$item->parentsNames = $parentNames;
|
||||
$item->parentsPath = implode('/', $parentNames);
|
||||
$item->parentsIds = $parents->pluck('id')->toArray();
|
||||
$item->parentsIdPointer = implode('_', $parentNames);
|
||||
|
||||
$productGroupArray[] = $item->toArray();
|
||||
}
|
||||
|
||||
@ -118,19 +122,25 @@ public function allWithPath($maxDepth = 999): array
|
||||
$pathSeparator = '/';
|
||||
$pointerSeparator = '_';
|
||||
|
||||
$productGroups = $this->withDepth()->with('ancestors')->get();
|
||||
|
||||
$productGroupArray = [];
|
||||
$productGroups = $this->withDepth()->get();
|
||||
foreach ($productGroups as $item) {
|
||||
if ($item->depth > $maxDepth) {
|
||||
continue;
|
||||
}
|
||||
$children = ProductGroup::descendantsOf($item);
|
||||
(count($children) > 0) ? $item->hasChild = true : $item->hasChild = false;
|
||||
$parents = ProductGroup::ancestorsOf($item);
|
||||
$item->parentsNames = ProductGroup::ancestorsOf($item)->pluck('name')->toArray();
|
||||
$item->parentsIds = ProductGroup::ancestorsOf($item)->pluck('id')->toArray();
|
||||
$item->parentsPath = implode('/', ProductGroup::ancestorsOf($item)->pluck('name')->toArray());
|
||||
$item->parentsIdPointer = implode('_', ProductGroup::ancestorsOf($item)->pluck('name')->toArray());
|
||||
|
||||
$item->hasChild = ($item->_rgt - $item->_lft) > 1;
|
||||
|
||||
$parents = $item->ancestors;
|
||||
$parentNames = $parents->pluck('name')->toArray();
|
||||
$parentIds = $parents->pluck('id')->toArray();
|
||||
|
||||
$item->parentsNames = $parentNames;
|
||||
$item->parentsIds = $parentIds;
|
||||
$item->parentsPath = implode('/', $parentNames);
|
||||
$item->parentsIdPointer = implode('_', $parentNames);
|
||||
|
||||
if (count($item->parentsIds) > 0) {
|
||||
$item->fullPath = $item->parentsPath.$pathSeparator.$item->name;
|
||||
$item->fullPointer = $item->parentsIdPointer.$pointerSeparator.$item->name;
|
||||
|
||||
44
tests/Pest.php
Normal file
44
tests/Pest.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Test Case
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The closure you provide to your test functions is always bound to a specific PHPUnit test
|
||||
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
|
||||
| need to change it using the "uses()" function to bind a different classes or traits.
|
||||
|
|
||||
*/
|
||||
|
||||
uses(Tests\TestCase::class)->in('Feature', 'Unit');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expectations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When you're writing tests, you often need to check that values meet certain conditions. The
|
||||
| "expect()" function gives you access to a set of "expectations" methods that you can use
|
||||
| to assert different things. Of course, you may extend the Expectation class at any time.
|
||||
|
|
||||
*/
|
||||
|
||||
expect()->extend('toBeOne', function () {
|
||||
return $this->toBe(1);
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Functions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
|
||||
| project that you don't want to repeat in every file. Here you can register helper functions.
|
||||
|
|
||||
*/
|
||||
|
||||
function something()
|
||||
{
|
||||
// ..
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user