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
    
                    Student::where('name', '=', 'manoj')->get();
                    
    Output
    
                        select * from students where name='manoj'
                    
    Query
    
                    Student::where('age', '>', '10')->get();
                    
    Output
    
                        select * from students where age>'10'
                    

    5. Multiple where ()

    Query
    
                    Student::where('name', '=', 'manoj')->where('age', '>', '10')->get();
                    
    Output
    
                        select * from students where name='manoj' and age>'10'