Using the accepted answer here, I wanted to return all objects based on created_at.
$projects = [ {id => 1,..., 'created_at' => "2017-05-15 14:46:32",...}, ]
$time = strtotime('2017-05-15'); // format issue?
$newformat = date('Y-m-d',$time); // "2017-05-15"
$projects = $user->projects->where('created_at', $newformat);
Im getting back an empty array for $projects, same in tinker. Yes, eloquent is perfect. Am I going it the right way?
Since I am here, I need to query two dates ie $from and $to with whereBetween:
$projects = $user->projects->whereBetween('created_at', [$from, $to])->toArray();
I cant remember where I saw whereBetween from but that give me the error:
$from and $to would be similar to $newformat.
Method whereBetween does not exist.