Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9|Last
Lessons:-Fluent Query Builder

10.2 Where Clauses
So now we have the methods that we need to retrieve our database results, how can we apply
conditions to these SQL queries? Well in the example above you saw me using the where()
method, let’s take a closer look at this.
1 <?php
2
3 $users = DB::table('users')->where('username', '=', 'dayle')->get();
Here we have the same snippet again, but we are concentrating on the where() part of the chain
:
1 <?php
2
3 where('username', '=', 'dayle')
The great thing about how Laravel handles the where clause is that the chain looks a little bit like
the SQL being generated. In the chain method above we are saying WHERE username = 'dayle'.
The first parameter to the method states the field which we are comparing, the second parameter
states the operator to use for the comparison, and the third parameter is the value which we are
comparing with. We could also use :

 

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)