Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make setEvents accept MessageBag objects [feature request] #14

Open
carcinocron opened this issue Aug 13, 2014 · 2 comments
Open

Make setEvents accept MessageBag objects [feature request] #14

carcinocron opened this issue Aug 13, 2014 · 2 comments

Comments

@carcinocron
Copy link

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);

@makzumi
Copy link
Owner

makzumi commented Sep 4, 2014

Hi, nice idea, will look into it

@rginnow
Copy link

rginnow commented Sep 26, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants