-1

How to combine POST and UPDATE commands in one action in laravel 8 with ajax?

I have one column "status" in another table that I need to update when I save the data.

In this case basically I have two different tables... thank you for your answer!

Update from the comments:

I have two different database tables, let's say the "Quotation" and "Detail Quotation" tables, where in the "Detail Quotation" table there is a Status column that contains TRUE or FALSE...

Well, I want when I add data to the Quotation table, I also run the command to change the contents of the status column in the "Detail Quotation" table.

2
  • 5
    Please post some code as well to understand the problem better
    – Zihad
    Commented Jul 23, 2021 at 7:14
  • I have two different database tables, let's say the "Quotation" and "Detail Quotation" tables, where in the "Detail Quotation" table there is a Status column that contains TRUE OR FALSE... well, I want when I add data to the Quotation table, I also run the command to change the contents of the status column in the "Detail Quotation" table
    – Bumblebeen
    Commented Jul 23, 2021 at 7:34

2 Answers 2

0

you must use observer for this case https://laravel.com/docs/8.x/eloquent#observers

0

When you save the POST data in table. Laravel return ID then, with that ID you can call the update function for another table to update the status.

Not the answer you're looking for? Browse other questions tagged or ask your own question.