laravel-firebase-sync icon indicating copy to clipboard operation
laravel-firebase-sync copied to clipboard

Not a real sync yet

Open toby78 opened this issue 8 years ago • 3 comments

If:

  • another script or component changes data from firebase
  • if data is deleted inside firebase console
  • if firebase commands dont get executed

The local db and firebase will be out-of-sync.

For true syncronization there needs to be an additional event handler for firebase events.

As mentioned inthe previous ticket 100% synchronization probably required Firebase to be Master.

Firebase Events will always be called if changes occur.

toby78 avatar Sep 26 '16 12:09 toby78

Until recently, this was not possible. Now that Firebase has implemented Cloud Functions, you could tap into Firebase Realtime Database Triggers and perform logic.

Requirements to get Firebase Syncing back to Laravel

  • Setup webhook route in Laravel that listens for Firebase database changes, and updates Eloquent model.
  • Add the webhook URL to your Firebase Environment Config
  • Deploy a JavaScript Firebase Cloud Function file (to Firebase) that listens for database changes and then broadcasts them to the webhook defined in the environment.

This laravel-firebase-sync project could also include the JavaScript file for the Firebase Cloud Function. Since there isn't a package.json file yet, one could be created for the "JavaScript" portion of the package.

mikemclin avatar May 03 '17 19:05 mikemclin

Any Ideas if the package will support this ?

nacr avatar Dec 19 '17 13:12 nacr

+1

tusharvikky avatar Mar 04 '18 20:03 tusharvikky