[英]How to return array from three joined tables Laravel 5
我有三張桌子
- Patients
- Medicines
- Services
- Patient_medicines
- Patients_services
我離開了他們,並獲得了以下結果
firstname : Nassoro,
lastname : Hamisi
Medicines : Dou Cotexin
Services : See a Doctor
firstname : Nassoro,
lastname : Hamisi
Medicines : Dou Cotexin
Services : TEST UTI
firstname : Nassoro,
lastname : Hamisi
Medicines : Malaphin
Services : See A doctor
firstname : Nassoro,
lastname : Hamisi
Medicines : Malaphin
Services : TEST UTI
但我想得到數組
firstname : Nassoro
lastname : Hamisi
Medicines :{'Malaphon' , 'Duo Cotexin'}
Services : {'See a Doctor' , 'TEST UTI'}
我正在使用Laravel
您可以對結果進行編碼以獲取所提及的輸出
將結果存儲在變量中,並將其傳遞給編碼方法
json_encode($variable);
希望它對你有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.