title: How do i resolve Call to a member function only() on array error
body: <p>I want to use laravels FormRequest to validate before updating some fields. This works fine if i just use:</p>
  <pre><code>User::find($application-&gt;userid)-&gt;fill($request-&gt;only('first_name'...
  </code></pre>
  <p>but the request also contains sub array ($request-&gt;programmeData).</p>
  <pre><code>array:2 [▼
    &quot;programme_id&quot; =&gt; 5
    &quot;programme_title&quot; =&gt; &quot;some programme title&quot;
  ]
  </code></pre>
  <p>if i try access that the same way i get 'Call to a member function only() on array':</p>
  <pre><code>Course::find($application-&gt;userid)-&gt;fill($request-&gt;programmeData-&gt;only('programme_id...
  </code></pre>
  <p>I've tried a handful of things, but not sure best way to go with this?</p>
  <p><strong>Update</strong><br />
  I'm now using a foreach loop to save two items in the array. the example below saves the second value for both user_ids. any reason this isn't saving the first value for the first user_id?</p>
  <pre><code>foreach ($request-&gt;programmeData['userProgrammes'] as $key=&gt;$userProgrammes) {
     Course::where('application_id', $application-&gt;id)-&gt;get()[$key]-&gt;fill(Arr::only($request-&gt;programmeData['userProgrammes'][$key], ['programme_id']))-&gt;save();
  }
  </code></pre>
  <p>but nothing updates. Any ideas on this one?</p>