12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- // +----------------------------------------------------------------------
- // | Tplay [ WE ONLY DO WHAT IS NECESSARY ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017 http://tplay.pengyichen.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 听雨 < 389625819@qq.com >
- // +----------------------------------------------------------------------
- namespace app\admin\model;
- use think\Model;
- class AdminMenu extends Model
- {
- public function menulist($cate, $id = 0, $level = 0)
- {
- static $cates = array();
- foreach ($cate as $value) {
- if ($value['pid'] == $id) {
- $value['level'] = $level + 1;
- $value['str'] = $level == 0 ? "" : str_repeat('  ', $level) . '└ ';
- $cates[] = $value;
- $this->menulist($cate, $value['id'], $value['level']);
- }
- }
- return $cates;
- }
- public function log()
- {
- return $this->hasOne('AdminLog');
- }
- }
|