Tuesday, March 7, 2017

How to pass id from while loop to controller without URL [laravel 5.4]

how to send a specific id to the controller in order to get data from another table related to this id ?

Which mean there's no U RL to send the data. Is that possible

For example

in procedural programming I will do it like this

while($posts= sqlsrv_fetch_array($post_data,SQLSRV_FETCH_ASSOC)) {

                //display some data ......
                // inside the loop i will have another query to get data from another  
               //table has relation with post table

                $id = $posts['id'];
                $customer = "SELECT * FROM [ccl].[customer] WHERE id = '$id' ";

                $get_customer_info = sqlsrv_query($conn, $customer);
           $get_customer_id = sqlsrv_fetch_array($get_customer_info,SQLSRV_FETCH_ASSOC);

                $customer_phone = $get_customer_id['customer_phone'];
            }

the idea each post has specific id, so I want to send the id to controller to retrieve data from another shipment table or any table associated with this id.

How can I do this in laravel



via Ahmadz Issa

Advertisement