Created
August 4, 2014 20:42
-
-
Save sabid/27a387aced756a9841ba to your computer and use it in GitHub Desktop.
Filter records according to year using Laravel Eloquent ORM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('/year',function() | |
{ | |
$year= '2013'; | |
return Post::whereRaw('YEAR(`posted_date`) = ?', array($year))->get(); | |
}); | |
Auto: | |
http://albertokempis.com/content/filter-records-according-year-using-laravel-eloquent-orm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment