Found it:
Model::whereBetween('created_at', array(Carbon\Carbon::createFromDate(2010, 1, 1)->toDateTimeString(), Carbon\Carbon::createFromDate(2012, 1, 1)->toDateTimeString()))->get();
This example uses Brazilian date format (d/m/Y).
$model = Model::with(['access'])
->select(['id','title','slug','created_at','status'])
->withTrashed();
$from = Carbon::createFromFormat('d/m/Y', Input::get('date'))
->startOfDay()
->toDateTimeString();
$to = Carbon::createFromFormat('d/m/Y', Input::get('date'))
->endOfDay()
->toDateTimeString();
$model = $model->whereBetween('created_at', [$from, $to]);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community