Skip to content

Commit

Permalink
Merge pull request #133 from khs1001/master
Browse files Browse the repository at this point in the history
扩展菜单父级支持根据url路径对应
  • Loading branch information
slowlyo authored Jul 4, 2024
2 parents b34c877 + d9e2ef9 commit 580d782
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Extend/CanImportMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Slowlyo\OwlAdmin\Extend;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Slowlyo\OwlAdmin\Admin;
use Illuminate\Support\Facades\Validator;

Expand Down Expand Up @@ -96,6 +97,12 @@ protected function getParentMenuId($parent)

$menuModel = $this->getMenuModel();

if (Str::startsWith($parent,'/')){
return $menuModel::query()
->where('url', $parent)
->value('id') ?: 0;
}

return $menuModel::query()
->where('title', $parent)
->where('extension', $this->getName())
Expand Down

0 comments on commit 580d782

Please sign in to comment.