laravel-calendar
laravel-calendar copied to clipboard
Make setEvents accept MessageBag objects [feature request]
Your example array:
$events = array(
"2014-08-09 10:30:00" => array(
"Event 1",
"Event 2 <strong> with html</stong>",
),
"2014-08-12 14:12:23" => array(
"Event 3",
),
"2014-09-14 08:00:00" => array(
"Event 4",
),
);
$cal->setEvents($events);
can be rewritten as:
$events = new Illuminate\Support\MessageBag;
$events->add("2014-08-09 10:30:00", "Event 1");
$events->add("2014-08-09 10:30:00", "Event 2 <strong> with html</stong>");
$events->add("2014-08-12 14:12:23", "Event 3");
$events->add("2014-09-14 08:00:00", "Event 4");
$cal->setEvents($events);
Currently, it works if you use $cal->setEvents($events->toArray());
instead.
MessageBag has cool features like $bag1->merge($bag2);
Hi, nice idea, will look into it
It looks like MessageBag comes with Laravel 4.2 now... this would make the code cleaner. Is it as effective? And how would this work with @makzumi's array_group_by() function?