当前位置:网站首页>Comparison between model sorting fields in laraveladmin

Comparison between model sorting fields in laraveladmin

2022-06-09 10:33:00 Brother Jing

LaravelAdmin in model Comparison between sorting fields

Compare the size of the two fields , hold A Greater than B Find out

It can be used    whereRaw('buyprice > productprice')  such

  $price_error = isset($_GET['price_error']) ? $_GET['price_error'] : 0;

  if ($price_error == 0) {
       $grid->model()->orderBy('goods_id', 'desc');
  }


  if ($price_error == 1) {
       $grid->model()->whereRaw('buyprice > productprice')->orderBy('goods_id', 'desc');
  }

demand : Find out buyprice > productprice The data of

It can be used

$grid->model()->whereRaw('buyprice > productprice');

原网站

版权声明
本文为[Brother Jing]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090951201313.html