title: Laravel keep chosen select value
body: <p>I am building an app in Laravel that uses the jQuery <a href="https://harvesthq.github.io/chosen/" rel="nofollow">Chosen</a> plugin.  When a user submits a form I am using requests to validate the form.  However if they are redirected back, for example if they miss a required field, then the Chosen select field does not keep their value.</p>
  
  <p>My code is below.  What am I missing?</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>/**
   * Show the form for creating a new resource.
   *
   * @return Response
   */
  public function create()
  {
      return view('admin.newContractor')
          -&gt;with('timesheetTemplates', $this-&gt;timesheet-&gt;listTemplates())
          -&gt;with('supervisors', $this-&gt;user-&gt;getUsersByRole($this-&gt;role-&gt;findRoleByName('Supervisor')-&gt;id)-&gt;lists('email', 'id'))
          -&gt;with('contractorRoleId', $this-&gt;role-&gt;findRoleByName('Contractor')-&gt;id)
          -&gt;with('rateFields', $this-&gt;rate-&gt;all())
          -&gt;with('miscFields', $this-&gt;misc-&gt;all())
          -&gt;with('workTypes', $this-&gt;timesheet-&gt;getTypeWork());
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>{!! Form::open([]) !!}
  ...
  
      {!! Form::label('supervisors', 'Assign Supervisor(s)') !!}
      {!! Form::select('supervisors[][supervisor_id]', $supervisors, null, ['class' =&gt; 'chosen-select', 'multiple']) !!}
  
  ... 
  {!! Form::close([]) !!}
  </code></pre>
  
  <p><strong>Request</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Requests\Admin;
  
  use App\Http\Requests\Request;
  use Illuminate\Contracts\Validation\Validator;
  use Illuminate\Validation\Factory as ValidatorFactory;
  use String;
  
  class CreateUserRequest extends Request
  {
      /**
       * Determine if the user is authorized to make this request.
       *
       * @return bool
       */
      public function authorize()
      {
          return true;
      }
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function rules()
      {
          return [
              'first_name'        =&gt; 'required',
              'last_name'         =&gt; 'required',
              'email'             =&gt; 'required|unique:user,email',
          ];
      }
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function validator(ValidatorFactory $factory)
      {
          if(!$this-&gt;get('status'))
          {
              $this-&gt;merge(['activation_code' =&gt; String::random(30)]);
          }
  
          return $factory-&gt;make($this-&gt;input(), $this-&gt;rules(), $this-&gt;messages());
      }
  }
  </code></pre>
  
  <p><strong>Edit:</strong> The result of <code>$this-&gt;rate-&gt;all()</code> is:</p>
  
  <pre><code>Collection {#315 ▼
  #items: array:4 [▼
    0 =&gt; Rate {#316 ▼
      #table: "rate"
      #fillable: array:3 [▶]
      +timestamps: true
      #connection: null
      #primaryKey: "id"
      #perPage: 15
      +incrementing: true
      #attributes: array:6 [▼
        "id" =&gt; 1
        "cust_id" =&gt; 1
        "field" =&gt; "hourly_rate"
        "name" =&gt; "Hourly Rate"
        "created_at" =&gt; "2015-09-07 08:11:46"
        "updated_at" =&gt; "2015-09-07 08:11:46"
      ]
      #original: array:6 [▶]
      #relations: []
      #hidden: []
      #visible: []
      #appends: []
      #guarded: array:1 [▶]
      #dates: []
      #dateFormat: null
      #casts: []
      #touches: []
      #observables: []
      #with: []
      #morphClass: null
      +exists: true
      +wasRecentlyCreated: false
    }
    1 =&gt; Rate {#317 ▶}
    2 =&gt; Rate {#318 ▶}
    3 =&gt; Rate {#319 ▶}
  ]
  </code></pre>
  
  <p>}</p>