Laravel $request->get() vs. $request->input()

Just say you have form with inputs:

<form>
    <input name="items[category][item1]">
    <input name="items[category][item2]">
    <input name="items[category][item3]">
</form>

With get:

$request->get('items')['category']['item1'];

With input:

$request->input('items.category.item1');

$request->input() combines get() with data_get() helper.

More about data_get helper you can read at vendor/laravel/framework/src/Illuminate/Support/helpers.php

  /**
    * Get an item from an array or object using "dot" notation.
    *
    * @param  mixed   $target
    * @param  string|array  $key
    * @param  mixed   $default
    * @return mixed
    */
    function data_get($target, $key, $default = null) {...}
Share on FacebookShare on RedditShare on Google+Tweet about this on TwitterShare on LinkedIn
don't waste your time using copy/paste, just use share buttons above
Laravel $request->get() vs. $request->input()