THINKPHP5.0 paginate count

problem description

because there are too many queries, the paginate page that comes with TP5.0 will execute a count sql, when querying. How to specify this sql when using paginate in model

related codes

/ / Please paste the code text below (do not replace the code with pictures)
$paginate = config ("paginate");

    $paginate["sql"] = "SELECT count(*) FROM `user`";
    config("paginate", $paginate);
    return $this->alias("u")
        ->field($field)
        ->join("vehicle v","u.user_id = v.user_id and v.is_delete = 1","left")
        ->join("ncd_user_wealth w","u.user_id = w.uid","left")
        ->where($map)
        ->group("u.user_id")
        ->order("u.user_id desc")
        ->paginate();

clipboard.png

what result do you expect? What is the error message actually seen?

how to replace sql, in a picture with SELECT count (*) FROM user to execute

Php
Mar.27,2022
Menu