Skip to content

Commit

Permalink
Fix var names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel authored Jul 11, 2024
1 parent 1f4dcb8 commit 1577a1e
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/Http/Controllers/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public function search(Request $request): Collection
$date = $item->created_at->toIso8601String();
}

if (isset($dashboardModule['parentRelationship'])) {
if (isset($module['parentRelationship'])) {
/** @var BelongsTo $parent */
$parent = call_user_func([$item, $dashboardModule['parentRelationship']]);
$parent = call_user_func([$item, $module['parentRelationship']]);
$parent_id = $parent->getParentKey();

if (empty($parent_id)) {
Expand Down Expand Up @@ -573,19 +573,14 @@ private function getDrafts(Collection $modules): Collection
$query->mine();
}

if (isset($dashboardModule['parentRelationship'])) {
if (isset($module['parentRelationship'])) {
/** @var BelongsTo $parent */
$parent = call_user_func([$activity->subject, $dashboardModule['parentRelationship']]);
$query->whereHas($module['parentRelationship']);
}

return $query->get()->map(function ($draft) use ($module, $parent) {
if (isset($parent)) {
$parent_id = $parent->getParentKey();

if (empty($parent_id)) {
// Prevent module route error
return null;
}
return $query->get()->map(function ($draft) use ($module) {
if (isset($module['parentRelationship'])) {
$parent_id = call_user_func([$draft, $module['parentRelationship']])->getParentKey();
}

return [
Expand Down

0 comments on commit 1577a1e

Please sign in to comment.