示例#1
0
 /**
  * 获取操作
  */
 public function getActions($role = null)
 {
     if ($role) {
         $datas = ActionModel::where('role_id', $role)->orderBy('pid', 'asc')->get();
     } else {
         $datas = ActionModel::orderBy('pid', 'asc')->get();
     }
     return $datas;
 }
示例#2
0
 /**
  * 获得所有父级
  */
 public function getParents()
 {
     $parents = ActionModel::where('pid', 0)->get();
     $parentArr = array(0 => '所有');
     if (count($parents)) {
         foreach ($parents as $parent) {
             $parentArr[$parent->id] = $parent->name;
         }
     }
     return $parentArr;
 }
示例#3
0
 /**
  * 排序 +1 increase
  */
 public function reduce($id)
 {
     $action = ActionModel::find($id);
     if ($action->sort > 0) {
         ActionModel::where('id', $id)->increment('sort', -1);
     }
     return redirect(DOMAIN . 'admin/action');
 }