Where clause with date_formate() in Laravel
In this blog, we will see that how we can use where clause with date_formate() in laravel with the query builder.
By using DB class of Laravel we can create query with query builder.
DB::raw() of Laravel
$data = DB::table("customers") ->select("id","name","created_at") ->where(DB::raw("(DATE_FORMAT(created_at,'%Y-%m'))"),"2022-06") ->get(); print_r($data);
So, thanks for following this blog, and if you need any help please leave your queries in the comment box we will be happy to help you.