dongsibao8977 2014-10-06 20:09
浏览 99

Laravel makhzumi / laravel-calendar获取并显示日期上的多个不同事件

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集