whereYear Query Use in Laravel 5.8, whereYear Query Use in Laravel 5.7, whereYear Query Use in Laravel 5.6, whereYear Query Use in Laravel 5.5, whereYear Query Use in Laravel 5.4, whereYear Query Use in Laravel 5.3, whereYear Query Use in Laravel 5.2
Hello Friends Today I will tell you through tutorials that whereYear query is used in the laravel framework.
The whereYear method may be used to compare a column’s value against a specific year.
$year = '2019'; $blog = DB::table('blogs') ->whereYear('created_at', $year) ->get();
By creating a model of your table, this query can be written in this way
$year = '2019'; $blog = Blog::whereYear('created_at', $year)->get();