[ad_1]
I’m working on a project where users insert their workout every day .
Each user can insert their workout date choosing from a calendar storing it in Exercise table in Date form.
I’ve written this to calculate the workout days in the current month
DB::table('exercises')
->select('day')
->where('user_id', Auth::user()->id)
->whereMonth('day', date('m'))
->whereYear('day', date('Y'))
->distinct()
->get()
->count()
and I want to display for each user the month with the highest workout days, I can do so with storing every month’s workout days in a separate table but I don’t know how to only extract the month from the dates already stored
[ad_2]