Skip to content
Advertisement

How to use the passed data in to a sql query?

How do I pass the $id into my $record SQL query and what is the eloquent query as well?

I want to do this because the user_id is the foreign key from borrows. I want to pull data from payment_records that have the same id with the selected id.

This is the show method where I passed the id and do the query:

This is the query where I want to use the id to compare with user_id:

Advertisement

Answer

I think you are after something similar:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement