NewMenu.php 787 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Models;
  3. class NewMenu extends BaseModel
  4. {
  5. protected $table="dc_navs";
  6. public $timestamps = false;
  7. //获取所有菜单
  8. function getMenuAll(){
  9. $data=$this->get();
  10. if(!$data){
  11. return -6010000522;//没有数据
  12. }
  13. return $data->toArray();
  14. }
  15. //根据id获取菜单信息
  16. function getMenuById($id){
  17. $data=$this->where('id',$id)->first();
  18. if(!$data){
  19. return -6010000522;//没有数据
  20. }
  21. return $data->toArray();
  22. }
  23. //获取父级菜单
  24. function getMenuParent(){
  25. $data=$this->where('parent_id',0)->where('type',0)->get();
  26. if(!$data){
  27. return -6010000522;//没有数据
  28. }
  29. return $data->toArray();
  30. }
  31. }