1
我試圖讓表嵌套繼承並篩選某些列。無法找到容易做到的事情。Laravel Eloquent從嵌套表中獲取某些列使用()
我有錶店女巫有許多地方(和位置都有一個城市)和許多行動
我想這一切在一次與口才,對特定的列過濾器。
這是我過濾商店表,但不知道如何過濾表位置和操作。
$this->shop->with('locations')->with('actions')->get(array('id','name','recommended','category_id'));
我需要的是這樣的:
$this->shop
->with('locations',Location::with('city', City::get(array('id','name')))->get(array('id','name')))
->with('actions', Action::get(array('id','name')))->get(array('id','name')););
以及我試圖與查詢builde連接表,但它不工作。 $ stores = DB :: table('shops') - > join('locations','locations.shop_id','=','shops.id') - > join('actions','actions.shop_id ','=','shops.id') - > select('shops.id','locations.id','actions.id'); – zajca
你如何鏈接多個這些?我嘗試向數組中添加另一個函數,但它失敗了。謝謝 – Notflip