Posts

Showing posts with the label Foreign key

Chapter 8 - Add data to Firebase using Laravel PHP

Image
In this chapter, we will learn how to insert data in Firebase Cloud Firestore from Laravel Firebase SDK demonstrating usage of various data types. Insert a simple student data in Student collection $stuRef = app('firebase.firestore')->database()->collection('Student')->newDocument(); $stuRef->set([ 'firstname' => 'John', 'lastname' => 'Doe', 'age' => 30 ]); Here firebase autoconsider the data type i.e firstname is string, lastname is string and age is number. Following are the example of sending different datatypes $docRef->set([ 'stringExample' => 'Hello World', 'booleanExample' => true, 'numberExample' => 3.14159265, 'timestampExample' => new \Google\Cloud\Core\Timestamp(new \DateTime(date('Y-m-d H:i:s', strtotime('2020-03-03 23:12:55')...