I assume recording date of a user's the last activity as 13.04.2019 . I want to sum all records in the week belonging the last record.
ex:
created_at = 13.04.2019, activity = 3
created_at = 11.04.2019, activity = 3
created_at = 01.04.2019, activity = 3
//the above 3 records is not same week. I need last week to sum activites so the result of sum will be 6
How could I do this with Carbon or others
$sum_last_week = Model::where('user_id',$user->id)->orderby('id','desc')->sum('activity')
....