laravel-firebase-sync | Eloquent models with a Firebase Realtime Database | Database library
kandi X-RAY | laravel-firebase-sync Summary
kandi X-RAY | laravel-firebase-sync Summary
Synchronize your Eloquent models with a Firebase Realtime Database.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Boot the sync with the model .
- Save data to firebase client .
- Get Firebase sync data .
- Set the firebase client
laravel-firebase-sync Key Features
laravel-firebase-sync Examples and Code Snippets
Community Discussions
Trending Discussions on laravel-firebase-sync
QUESTION
Integrating Firebase in "RESTFUL API" for the first time. The data had to sync into two databases i.e. MySQL and Firebase but the data didn't sync in Firebase.
Installation of firebase sync trait
composer require mpociot/laravel-firebase-sync
The configuration code to integrate Firebase into my API :-
...ANSWER
Answered 2018-Jan-18 at 08:43You can do like this:
QUESTION
I'm using the Laravel-firebase-sync package. In their docs they say:
If you need more control over the data that gets synchronized with Firebase, you can override the
getFirebaseSyncData
of theSyncsWithFirebase
trait and let it return the array data you want to send to Firebase.
But I can't locate that method. I want to know if someone that has already used this package know a way to custom the object that get syncronized.
Why I want to do this? Well, I'm using Laravel as a backend, so in one model I have Restaurant
, there I have a field called min_price_range
that is an integer
that goes from 1-4. But before I return it I transform it to $-$$$$. So I need to do this before the object gets sync in Firebase. Otherwise the objects won't match between Laravel and Firebase databases (when consumed in mobile client apps).
PD1: I've already test it and it doesn't work. It just sync the hole object (the fields of the visible
array).
PD2: Yes, I've already opened an issue in the project repository but they seem to response a couple months after.
Thanks in advance.
...ANSWER
Answered 2017-Dec-18 at 09:12Could you share the code you've written so far from your Restaurant
model class, please?
Could you also explain what you mean when you state:
I have a field called min_price_range that is an integer that goes from 1-4. But before I return it I transform it to $-$$$$
Regarding the trait and method, you could not locate you should be able to find it here: https://github.com/mpociot/laravel-firebase-sync/blob/master/src/Mpociot/Firebase/SyncsWithFirebase.php#L50
The trait would be referenced via the following namespace: Mpociot\Firebase\SyncsWithFirebase
So I assume if you wish to override the method you would do something like this in your Restaurant
model class:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install laravel-firebase-sync
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page