修改导航

This commit is contained in:
2021-02-03 13:41:18 +08:00
parent 8ffea65936
commit 77d0d9ae92
12 changed files with 130 additions and 231 deletions

View File

@@ -6,6 +6,7 @@ use App\Models\Article;
use App\Models\Patent;
use App\Models\Talent;
use Encore\Admin\Auth\Database\Menu;
use Illuminate\Support\Arr;
function getOneCategory($categoryId, $return = '')
{
@@ -134,3 +135,25 @@ function getCate($id, $value = '')
return $info;
}
/**
* Notes: 获取所有上级
* @Author: 玄尘
* @Date : 2021/2/3 13:22
* @param $categoryId
* @return mixed
*/
function getAllParentCate($categoryId): array
{
$res = collect();
$parent = Category::find($categoryId);
$res->prepend($parent);
while ($parent->parent_id != 0) {
$parent = $parent->parent;
$res->prepend($parent);
}
return $res->all();
}