Download the PHP package elafries/firestore-model without Composer
On this page you can find all versions of the php package elafries/firestore-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elafries/firestore-model
More information about elafries/firestore-model
Files in elafries/firestore-model
Package firestore-model
Short Description A firestore model for laravel or lumen
License MIT
Informations about the package firestore-model
FirestoreModel for laravel or lumen
Initilaization
Set up credential file
Create and download a credential for service account
https://console.firebase.google.com/u/0/project/`${PROJECT_ID}`/settings/serviceaccounts/adminsdk
Copy the credential.json of the service account to root directory
eg: firebase-credential.json
Set up .env
Register service provider
Add this line to bootstrap/app.php
Creating a model
This will create a model, which will connect to the users
table
Handle model fields
table
This is an optional parameter.
The name will be generated from the lowercase classname joined with underscores.
eg:
ThisIsATable >> this_is_a_table
If you fill the $table
variable the table name will be overriden by its value.
fillable
When you insert to the database these fields will be added and the secure
fields ONLY!
hidden
When you fetch from the database, these fields will be hidden
secure
When you insert/update the database these fields will be encrypted.
When you insert to the database, it will extend the fillable parameters.
Using a model via dependency injection
Queries
List queries
Fetch all item in the database :array
Fetch items in the database with filtering :array
Fetch items in the database with multiple where filtering :array
Fetch items in the database with filtering and with all the hidden properties :array
Single result queries
Fetch the first in the database with filtering :array
Fetch the first in the database with filtering and with all the hidden properties :array
Fetch the first in the database by id :array
Fetch the first in the database by id, with all the hidden properties :array
Existence queries
Count all items in a query :int
Check if there is at least one result (exists) :bool
Insert :array
Update
Update by id :void
Update all which match the query :void
Delete
Delete all which match the query :void
All versions of firestore-model with dependencies
kreait/laravel-firebase Version ^3.1
illuminate/hashing Version 8.*
phpunit/phpunit Version ^9.5