laravel/framework — pull request #1802 by nightowl77 (2013-07-02 16:25:57+00:00)
Title: May we have support for array bracket syntax in helpers/array_get

Hi Guys

I get the feeling someone is going to throw me with a big old 21" CRT screen for this one, but please hear me out.

I refer to a use-case: Former (https://github.com/Anahkiasen/former) has great support for figuring out complex relations and populating your entire form simply with

```
Former::populate($user);
```

It is a life saver for a complex admin interface I'm building. If $user consists of a "hasmany order" and order "hasmany notes" I can then write

```
Former::text('order[notes][content]');
```

Former is great for figuring out this relationship and populating that form field with exactly the right "content" for that order note.

There is however a problem - when there is a validation error Former cannot get the input::old() values due to the way helpers.php/array_get works. There is a long standing issue regarding this. https://github.com/Anahkiasen/former/issues/122

I set out to fix this, and realized that when Former fetches the old input, it should convert the $key to dot notation. But this didn't seem very "laravelish" and I thought I could quickly try to add bracket syntax support to array_get. To my surprise the Laravel tests ran perfectly fine.

I know that previous issues on this mentioned that you have to use dot notation, but that makes parsing the POST data on forms with lots of relationships very difficult to parse and "hackish". PHP is one of the few languages with array input support and IMHO a great feature.

I therefore ask that the core developers of Laravel please consider my pull request. This immediately solves https://github.com/Anahkiasen/former/issues/122 without changing that code at all. It should make life easier for any package developer that would like to bind models to forms much easier.

I have added test coverage to make sure I cover all bases. Please don't throw bulky 80's technology at me.