'integer', 'account_type' => 'integer', 'belong_id' => 'integer', 'account_id' => 'integer', 'fd' => 'integer', 'status' => 'integer']; public static function list(array $param) { return self::where("status", 1) ->with(["account" => function ($query) { $query->select(["account_id", "username", 'dept_id']); }, "account.dept" => function ($query) { $query->select(["dept_id", "dept_name"]); }]) ->when(isset($param['username']) && $param['username'] != '', function ($q) use ($param) { $q->where('username', 'like', "%{$param['username']}%"); }) ->orderByDesc("online_id") ->select(['session_id', 'username', 'ip', 'ua', 'online_time', 'account_id']) ->paginate((int)$param['limit']); } public function account() { return $this->hasOne(Account::class, 'account_id', 'account_id'); } }