[英]get all records that was equal to the give id laravel eloqouent
我試圖檢索'user_id'為'1'的記錄,下面是我到目前為止嘗試但不幸的是沒有工作,任何想法,幫助?
$if_married = if_married::where('user_id', '=', '1');
return response()->json(['success' => true, 'if_married' => $if_married ]);
但是返回一個空的json數組。
我的數據庫設置(參見下文)
id (primary, auto_increment, int), children (varchar 250), type_of_delivery (varchar 250), dates (varchar 250), user_id (int)
你需要做一些改變
$if_married = if_married::where('user_id', '=', '1')->get();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.