If you want to selecting a data with two date start date and end date in laravel so you can use given example below-
Example 1:

$start_date=carbon::parse($startDate)->format(“Y-m-d”);
$end_date=carbon::parse($endDate)->format(“Y-m-d”);

$query=User::query();
$query->whereDate(“created_at”,”>=”, $start_date);
$query->whereDate(“created_at”,”<=”, $start_date);
$query->get();

And If you want selecting a data with single date field in laravel you can use given example below-
Example 2:

$date=carbon::parse($date)->format(“Y-m-d”);
$query=User::query();
$query->whereDate(“created_at”,”=”, $date);
$query->get();

News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: