I'm trying to fetch the first result from my data where the date is equal to last months date range.
This is can example of my database contents -
id date_recorded
1 2016-07-22 15:21:33
2 2016-08-13 12:22:22
3 2016-07-06 12:22:22
4 2016-09-12 12:45:22
This is my query to fetch the 2nd result (the most recent from the last month).
$seoScoreLastMonth = Manual::where('account_id', Auth::user()->account)
->where('date_recorded', '>=', Carbon::now()->subMonth())
->orderBy('date_recorded', 'desc')
->pluck('seo_score')
->first();
The result returned is null, this is because the first result in the database by id does not match the date?