Laravel 5 - where condition with two columns example code
By Hardik Savani | July 29, 2016 | | 31072 Viewer | Category : LaravelLaravel 5 introduce whereColumn() in Query Builder, that way we can compare two column like simple where condition. We sometimes require to check this type of condition.
In this example code, i have simple "items" table and i want to get only created_at and updated_at column should equals. So you can also check bellow laravel eloquent as bellow:
Example:
$data = DB::table("items")
->whereColumn('created_at','updated_at')
->get();
print_r($data);
Example 2:
$data = DB::table("items")
->whereColumn('created_at','>','updated_at')
->get();
print_r($data);
***Do you want me hire for your Project Work? Then Contact US.
Featured Post
We are Recommending you: