Advertisement
Evgarik

Untitled

Jul 14th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. $item = $userLists->with([
  2.                     'getListData'=>function($q){
  3.                            
  4.                         if($q->price_id>0){ // Как тут проверить что колонка price_id не равна нулю и на основании это продолжить выполнять код?
  5.                             $q->with([
  6.                                 'getProduct',
  7.                                 'getPrice',
  8.                                 'getPrice.priceShop'=>function($q){ $q->where('id','!=',0);},
  9.                                 'getPrice.priceShopNet'=>function($q){ $q->where('id','!=',0);}
  10.                                 ]);
  11.                         } else {
  12.                            $q->with([
  13.                                 'getProduct',
  14.                                 'getProduct.productPrice'
  15.                                 ]);
  16.                         }
  17.                     }
  18.                 ])->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement