Laravel打印该查询的SQL语句

            $query = PayoneerAccount::where([
                'ap_cid' => $apCid,
                'payoneer_id' => $payoneerId,
                'state' => $state,
            ]);
            
            $sql = $query->toSql();
            $bindings = $query->getBindings();
            
            foreach ($bindings as $binding) {
                $value = is_numeric($binding) ? $binding : "'{$binding}'";
                $sql = preg_replace('/\?/', $value, $sql, 1);
            }
            
            dd($sql);        

 

posted @ 2023-05-12 17:12  爱家家的卡卡  阅读(84)  评论(0编辑  收藏  举报