Posts

Showing posts from April, 2020

How to make Firebase query search not case sensitive #18

Image
How to make Firebase query search not case sensitive because you know Firebase provide exact match "==" with case sensitive. So we will solve this issue in the chapter in detail. We will use the Laravel PHP SDK for the firebase for all the queries stuff. Also we will see case insensitive sorting with Firebase orderBy using Firebase search ignoring case. Now lets consider a simple example, you have 'Student' list and you want to search by name. So the main use of any search is that, you insert one or two characters and the system should search the most matching one, but that not the case in Firebase. Firebase is a case sensitive. Means string "Name" and "name" are two different values for Firebase. All Firebase developers are facing this issue, which is most basic necessity. So lets first understand, currently what is provided by Firebase. See the below example of Student List. Now here you see, we have a Student ...

How to create custom firebase email templates and action handlers link #13

Image
Learn how to create custom email action handlers and change the Firebase email templates using Firebase email link authentication. Detailed how to implement the custom Firebase Auth Email verification template and send to user on signup. And the verification URL would contain URL to your site instead of Firebase default URL. And on visit of this URL, how to call verify method of Firebase Auth in Laravel PHP with little help of JavaScript SDK. Here, we assume, your are clear about Firebase Auth and you have enabled the Email/Password in the Sign-in method Now lets begin to customize the URL, you get in your firebase email verification template. It looks like something  https://test-cc4d3.firebaseapp.com/__/auth/action?mode=<action>&oobCode=<code> Here, in above image, you have edit button for the editing the template. Click on that, then you will have "customize action URL" link at the bottom...

Chapter 12 - Delete data from Firebase using Laravel PHP

Image
In this chapter, we will learn how to delete the data from Firebase Cloud Firestore database collection using Laravel Framework PHP SDK. Now consider the following list of students in the 'Student' collection Suppose you want to delete the Student by document id '8suVf4FphzZLuTFJtdFe', you have to fire the below query. app('firebase.firestore')->database()->collection('Student')->document('8suVf4FphzZLuTFJtdFe')->delete(); This will delete the Student data from Student collection. Now if you have to delete the student having id = 3, then this can be done by the following query $students = app('firebase.firestore')->database()->collection('Student')->where('id','==',3)->limit(1)->documents(); $students ->rows()[0]->delete(); Now consider if you have to delete students having 'passoutyear' ...

Chapter 11 - Update data to Firebase using Laravel PHP

Image
In this chapter, we will learn how to update data to Firebase Cloud Firestore using Laravel PHP package. Consider the list of Student in Firebase Cloud Firestore. We would update these student data for all different type of datatypes of fields. Update normal string field name $student = app('firebase.firestore')->database()->collection('Student')->document(<studentid>); Example $student = app('firebase.firestore')->database()->collection('Student')->document('defT5uT7SDu9K5RFtIdl') ->update([ ['path' => 'name', 'value' => 'John Kone'] ]); After update, firebase will look like this Before updating or even inserting a value for fields like Integer or float, boolean make sure you convert your request params to specific datatype $student = app('...

Chapter 10 - Fetch data from Firebase performing Simple and compound queries using Laravel PHP

Image
In this chapter, we will learn how to can fetch data from Firebase Cloud Firestore by performing simple and compound queries using Laravel PHP package. Consider the list of Student in Firebase Cloud Firestore. We would fetch these student data using all example of queries. Fetch the normal list $students = app('firebase.firestore')->database()->collection('Student')->documents(); print_r('Total records: '.$students->size()); foreach($students as $stu) { if($stu->exists()){ print_r('Student ID = '.$stu->id()); print_r('Student Name = '.$stu->data()['name']); } } Now search query, search by name in student list $students = app('firebase.firestore')->database()->collection('Student')->documents() ->where('name','==','John Doe'); Remember there is no...