Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait HandleNesting |
||
8 | { |
||
9 | /** |
||
10 | * The Laravel queue name to be used for the reordering operation. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $reorderNestedModuleItemsJobQueue = 'default'; |
||
15 | |||
16 | /** |
||
17 | * @param string $nestedSlug |
||
18 | * @param array $with |
||
19 | * @param array $withCount |
||
20 | * @param array $scopes |
||
21 | * @return \A17\Twill\Models\Model|null |
||
22 | */ |
||
23 | public function forNestedSlug($nestedSlug, $with = [], $withCount = [], $scopes = []) |
||
24 | { |
||
25 | $targetSlug = collect(explode('/', $nestedSlug))->last(); |
||
26 | |||
27 | $targetItem = $this->forSlug($targetSlug, $with, $withCount, $scopes); |
||
|
|||
28 | |||
29 | if (!$targetItem || $nestedSlug !== $targetItem->nestedSlug) { |
||
30 | return null; |
||
31 | } |
||
32 | |||
33 | return $targetItem; |
||
34 | } |
||
35 | |||
36 | public function setNewOrder($ids) |
||
40 | } |
||
41 | } |
||
42 |