|
|
|
@ -34,9 +34,8 @@ class AdminMenu extends Model |
|
|
|
if ($menu_ids) { |
|
|
|
$model->whereIn('id', $menu_ids); |
|
|
|
} |
|
|
|
$list = $model->where('parent_id', $parent_id)->whereNull( |
|
|
|
'deleted_at' |
|
|
|
)->select(['id', 'title'])->get()->toArray(); |
|
|
|
$list = $model->where('parent_id', $parent_id)->select(['id', 'title']) |
|
|
|
->get()->toArray(); |
|
|
|
foreach ($list as &$item) { |
|
|
|
$item['title'] = empty($item['title']) |
|
|
|
? '' |
|
|
|
@ -111,4 +110,19 @@ class AdminMenu extends Model |
|
|
|
'role_id' |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static function getParentIds(&$data, $menu_ids) |
|
|
|
{ |
|
|
|
$parent_ids = self::query()->where('status', 1)->whereIn( |
|
|
|
'id', |
|
|
|
$menu_ids |
|
|
|
)->pluck('parent_id'); |
|
|
|
if ($parent_ids) { |
|
|
|
$parent_ids = $parent_ids->toArray(); |
|
|
|
if (!in_array('0', $parent_ids)) { |
|
|
|
$data = array_merge($data, $parent_ids); |
|
|
|
self::getParentIds($data, $parent_ids); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|