I'm working on an webapp with Laravel, where I keep track of a users workouts, weigh-ins and food intake.
Weights
ID & other data
Date - YYYY-mm-dd
Workouts
ID & other data
Date - YYYY-mm-dd
Intakes
ID & other data
Date - YYYY-mm-dd
On the users dashboard a calendar is printed using "makzumi/laravel-calendar" located here. So now to my question, how should I think when trying to get all rows that have been added to this date. So when I look at my calendar, I could see that on the 6th of October the user have added a Weigh-in, a Workout and Intakes for this date.
So when I begun to populate all the Weigh-ins into the $events array like this.
$events= array();
foreach ($calendarWeights as $calWei) {
$events = array_add($array, $calWei->date, '[Weigh in]');
}
I saw that I could not just add the Workouts and Intakes after this snippet, because then the populated array would have duplicated dates, and the calandar would only show the [Weigh ins]. The array is supposed to be constructed in this manner.
$events = array(
"2014-04-09 10:30:00" => array(
"Workouts",
"Intakes",
"Weights",
),
"2014-04-12 14:12:23" => array(
"Intakes",
),
"2014-05-14 08:00:00" => array(
"Intakes",
),
);
But I can't figure out how I am supposed to do this, and any help would be much appriciated. I need someone to point me in the right direction so that I may proceed in the next steps of my webApp. I've also checked for other calendar packages, but not with much result.
EDIT: If you know of a better way to get a calendar, my mind is not written in stone about makzumi/laravel-calendar