Get selected value from select_from_array field using laravel 5.2 Backpack
<p>I am  using Laravel 5.2 Backpack in my new project where I have a <code>select_from_array</code> field in my form, depending upon the selected value I want data to be displayed in another <code>select_from_array</code> field. Don't know how to do that. Please help me with this. This is my code</p>

<p>Controller.php</p>

<pre><code>public function __construct()
{
    if (Request::segment(3) == 'create') {
        $parentField1 = [
        'name' =&gt; 'cat_id',
        'label' =&gt; 'Category',
        'type' =&gt; 'select_from_array',
        'options' =&gt; $this-&gt;categories(),
        'allows_null' =&gt; false,
        ];
        $parentField = [
            'name' =&gt; 'subCat_id',
            'label' =&gt; 'SubCategory',
            'type' =&gt; 'select_from_array',
            'options' =&gt; $this-&gt;subcategories(),
            'allows_null' =&gt; false,
        ];

        array_unshift($this-&gt;crud['fields'], $parentField1,$parentField);

    }

public function categories()
{
    $cat = Request::get('cat_id');

    $currentId = 0;
    if (Request::segment(4) == 'edit' and is_numeric(Request::segment(3))) {
        $currentId = Request::segment(3);
    }

    $entries = Category::where('translation_lang', config('app.locale'))-&gt;where('parent_id',0)-&gt;orderBy('lft')-&gt;get();
    if (is_null($entries)) {
        return [];
    }

    $tab = [];
    $tab[0] = 'Root';
    foreach ($entries as $entry) {
        if ($entry-&gt;id != $currentId) {
            $tab[$entry-&gt;translation_of] = '- ' . $entry-&gt;name;
        }
    }
    return $tab;
}

public function subcategories()
{
    $currentId = 0;

    if (Request::segment(4) == 'edit' and is_numeric(Request::segment(3))) {
        $currentId = Request::segment(3);
    }

    $entries = Category::where('translation_lang', config('app.locale'))-&gt;where('parent_id','!=' ,0)-&gt;orderBy('lft')-&gt;get();

    if (is_null($entries)) {
        return [];
    }

    $tab = [];
    $tab[0] = 'Root';
    foreach ($entries as $entry) {
        if ($entry-&gt;id != $currentId) {
            $tab[$entry-&gt;translation_of] = '- ' . $entry-&gt;name;
        }
    }
    return $tab;
}
</code></pre>

<p>I want the id of selected option in the <code>subcategories()</code> where I can use the id to get the data.</p>