Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lat4732's avatar
Level 12

Run DB query on each insert into a specific table

Hey!

I need to somehow change a boolean value of a column inside a table (websites) based on every insert in another table (reviews). Both tables have relationship. On a new review inserted into the reviews table I need to change a boolean value in websites table (webscore_recalculation_needed to true) to which the review refers (reviews.website_id). Do you guys have any idea how to do that? Note that I'm not using only 1 method, I'm using Eloquent & DB Query Builder (BOTH) in the whole application.

0 likes
3 replies
lat4732's avatar
lat4732
OP
Best Answer
Level 12

I did this with event & listener.

Please or to participate in this conversation.