Laravel / Model / Where condition using model
Where
-
STEP
1. where() method
to get specific row(s) from a table
2. Syntax
$model_object->where() 3. Parameters
The where() method accepts basically three parameters;
1. The column name 2. The operator(optional) 3. The query value 4. Example
Query
OutputStudent::where('name', '=', 'manoj')->get();
Queryselect * from students where name='manoj'
OutputStudent::where('age', '>', '10')->get(); select * from students where age>'10' 5. Multiple where ()
Query
OutputStudent::where('name', '=', 'manoj')->where('age', '>', '10')->get(); select * from students where name='manoj' and age>'10'