I've done some research on this, and I know I can either set up a DB listener in AppServiceProvider or create middleware to turn on logging and trap the next queries, which will give me the same result - the ability to see (get) the last SQL hit on the database, but I then want to store this query in a table in the same database. The question I have is this - won't doing THAT fire off another event which would then also get trapped by my listener/middleware and get stored again... again... again... infinite loop? Or am I missing something. Is there a better way to do this?
BACKGROUND: I have an external iOS APP that uses the same web data (duplicated sqlite version of this mysql db) as my laravel webapp and I want the APP to be able to 'ask' for any changes to the mysql db and run them against the sqlite db by hitting the laravel webapp and getting the sql statements that have been run against the mysql db since the last 'ask' which I've saved in a dbupdates table. Hence I want to track all (INSERT/UPDATE/DELETE) queries.
Thanks in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire