Monday, March 6, 2017

How to pass id from while loop to controller [laravel]

I'm new to laravel, so I'm searching for how to send a specific id to the controller in order to get data from another table ?

For example

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 [ccct].[ccctadm].[Shipment] 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'];
}

I can't write query in while loop in laravel, so how can I pass shipment id to the controller so I can get customer data related to the shipment



via Ahmadz Issa

Advertisement