title: BadMethodCallException: Method Illuminate\Database\Eloquent\Collection::update does not exist in Laravel
body: <p>I have this update controller in Laravel-5.8</p>
  <pre><code>  $leavetype = HrLeaveType::findOrFail($id);
    $leavetype-&gt;leave_type_name             = $request-&gt;leave_type_name;
    $leavetype-&gt;leave_type_code             = $request-&gt;leave_type_code;
    $leavetype-&gt;description                 = $request-&gt;description;
    $leavetype-&gt;company_id                  = Auth::user()-&gt;company_id;
    $leavetype-&gt;created_by                  = Auth::user()-&gt;id;
    $leavetype-&gt;created_at                  = date(&quot;Y-m-d H:i:s&quot;);
    $leavetype-&gt;is_active                   = 1; 
    
    $leavetype-&gt;save();                         
  
    $employeetypes = HrLeaveTypeDetail::where('leave_type_id', $id)-&gt;get();
  
    foreach ($employeetypes as $key =&gt; $employeetypes){
      $leavetypedetail = HrLeaveTypeDetail::where('leave_type_id', $id)-&gt;get();
  
      $insert_array = [
          'no_of_days'                        =&gt; $request-&gt;no_of_days[$key],
          'employee_type_id'                  =&gt; $request-&gt;employee_type_id[$key],     //$request-&gt;employee_type_id[$key],    
          'weekend_inclusive'                 =&gt; isset($request[&quot;weekend_inclusive$key&quot;]) ? 1: 0,
          'leave_type_id'                     =&gt; $leavetype-&gt;id,
      ];                
  
      $leavetypedetail-&gt;update($insert_array);
    }
  </code></pre>
  <p>view</p>
  <pre><code>  @foreach($leavetypedetails as $key =&gt; $leavetypedetail)
       &lt;tr&gt;
         &lt;td width=&quot;5%&quot;&gt;
              {{$key+1}}
         &lt;/td&gt;                             
         &lt;td width=&quot;30%&quot;&gt;  
              &lt;span&gt;{{$leavetypedetail-&gt;employeetype-&gt;employee_type_name}}&lt;/span&gt; 
         &lt;/td&gt;
         &lt;td style=&quot;display: none&quot;&gt;  
            &lt;input type=&quot;hidden&quot; name=&quot;employee_type_id[]&quot; value=&quot;{{$leavetypedetail-&gt;employeetype-&gt;employee_type_name}}&quot; class=&quot;form-control employee_type_id&quot;&gt;
         &lt;/td&gt;                                
         &lt;td width=&quot;20%&quot;&gt;&lt;input type=&quot;number&quot; name=&quot;no_of_days[]&quot; value=&quot;{{$leavetypedetail-&gt;no_of_days}}&quot; placeholder=&quot;Enter leave days here&quot; class=&quot;form-control no_of_days&quot; max=&quot;120&quot;&gt;
         &lt;/td&gt;                                                               
         &lt;td width=&quot;10%&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;weekend_inclusive{{$key}}&quot;  class=&quot;form-control&quot; data-bootstrap-switch data-off-color=&quot;danger&quot; data-on-color=&quot;success&quot; data-off-text=&quot;NO&quot; data-on-text=&quot;YES&quot; value=&quot;1&quot; {{  ($leavetypedetail-&gt;weekend_inclusive == 1 ? ' checked' : '') }}&gt;&lt;/td&gt;                         
       &lt;/tr&gt;
    @endforeach
  </code></pre>
  <p>When I submitted the form, I got this error:</p>
  <blockquote>
  <p>BadMethodCallException: Method Illuminate\Database\Eloquent\Collection::update does not exist
  app\Http\Controllers\Leave\LeaveTypesController.php(268): Illuminate\Support\Collection-&gt;__call('update', Array)</p>
  </blockquote>
  <p>and it points here:</p>
  <blockquote>
  <p>$leavetypedetail-&gt;update($insert_array);</p>
  </blockquote>
  <p>How do I resolve it?</p>
  <p>Thanks</p>