php - Laravel - query from database and save to another
Welcome! I try to find a solution for my problem but it's hard for fresh laravel user. I try to do some simple booking system. I have 2 tables: schedule, and bids. What I want to do is display schedule table and via "book" button save it to bids table. I know how to query schedule table but I don't know how to write controller to save same data to another table.
Regards and thank you for the help.
Answer
Solution:
You can do it in in the same controller class by adding a new function inside it. Here is the sample code.
Hope the answer has helped you.
Answer
Solution:
first of all you should show some examples of what have you done,
also your database connection file
however you should connect the 2 databases in
app/config/database.php
like the followingand then in the controller you can chose which database you are talking to for example
$users = DB::connection('mysql2')->select(...);
check the Laravel Documents