저는 laravel을 처음 사용하기 때문에 컨트롤러에 특정 ID를 보내어 다른 테이블에서 데이터를 가져 오는 방법을 찾고 있습니까? 예를 들어while 루프에서 컨트롤러로 아이디를 전달하는 방법 [laravel]
while($shipment = sqlsrv_fetch_array($get_customer_rule,SQLSRV_FETCH_ASSOC)) {
//display some data ......
// inside the loop i will have another query to get data from another table has //relation with shipment table
$id = $shipment['id'];
$customer = "SELECT * FROM [ccctadm].[customer] WHERE id = '$id' ";
$get_customer_info = sqlsrv_query($conn, $customer);
$get_customer_id = sqlsrv_fetch_array($get_customer_info,SQLSRV_FETCH_ASSOC);
$customer_id = $get_customer_id['customerid'];
}
내가 laravel에있는 동안 루프에서 쿼리를 작성할 수 없습니다, 그래서 때문에 선적
내가이 모든 것을 알고있는 결과와 함께 작동하지만, 그들 중 누구도 URL없이 컨트롤러에 ID를 보내는 이런 상황을 포함합니다. 유일한 해결책은 모두 조인을 사용하여 연결하는 것임을 알았지 만, 더 쉬운 방법을 찾을 수는 있겠지만. 설명해 주셔서 감사합니다 –