如何将查询转换为laravel?我的$ ID是md5
$ID = "aa8c96cf79a656e7ef095871ec061888";
$sql = "SELECT * FROM orders WHERE md5(CONCAT(`id`,`email`)) = '{$ID}' || md5(CONCAT(`code`,`email`)) = '{$ID}' ";
$order = DB::table('orders')->select(
??
);
谢谢
答案 0 :(得分:0)
尝试这样的事情:
$order = DB::table('orders')->whereraw('md5(CONCAT(`id`,`email`)) = ? || md5(CONCAT(`code`,`email`)) = ?',[$ID,$ID] );
有关更多详细信息,请参见此处: https://laravel.com/docs/5.8/queries#raw-expressions