$uid, 'companyNo' => $companyNo, 'status' => 1, 'is_del' => 0]) ->value('roleid',''); } public function RoleInfo(){ return $this->belongsTo(RoleAction::class,"roleid","role_id")->bind(['action_conllect']); } public static function getAllAction($uid=0,$companyNo='',$level=0){ switch ($level){ case 1: $action = Action::where(['is_del' => 0, 'status' => 1]) ->column('id'); break; case 2: $role = self::where([ 'uid' => $uid, 'companyNo' => $companyNo, 'is_del' => 0])->with('RoleInfo') ->findOrEmpty(); $action = $role->action_conllect??[]; break; case 3: $role = self::where([ 'uid' => $uid, 'is_del' => 0])->with('RoleInfo') ->findOrEmpty(); $action = $role->action_conllect??[]; break; default: $action = []; } return $action; } }