get where laravel code example

Example 1: laravel join

Inner Join 	: ->join('contacts', 'users.id', '=', 'contacts.user_id')
Left Join 	: ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
Right Join 	: ->rightJoin('posts', 'users.id', '=', 'posts.user_id')
Cross Join 	: ->crossJoin('colors')

Advance Queries : 
----------------- 
 		->join('contacts', function ($join) {
            $join->on('users.id', '=', 'contacts.user_id')
                 ->where('contacts.user_id', '>', 5);
        })

Example 2: where () laravel Eloquent

//los signos de igualdad pueden ser: ">=", "<=", "=", ">", "<"
$user = User::where("estado","=",1)->find(10);

Example 3: get all data eloquent laravel

Blog::all();

//example usage.
$posts = Blog::all();

Example 4: laravel where

$users = DB::table('users')
                ->whereDate('created_at', '2016-12-31')
                ->get();

Example 5: laravel where and where

Table::where('Column', Value)->where('NewColumn', Value)->get();

Example 6: laravel find query

foreach ($flights as $flight) {
    echo $flight->name;
}

Tags:

Sql Example