Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

melx's avatar
Level 4

Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, null given, called in

kindly may know where i did wrong? why am geting this error

      Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, null 
       given, called in

my controller

    if (count($request->unit_id) > 0) {
        foreach ($request->unit_id as $key => $v) {
            $data2 = ([
                'issued_by'=>Auth::user()->id,
                'unit_id' => $request->unit_id[$key],
                'team_id' => $request->team_id,
                'req_by'=>$request->req_by,
                'purpose'=>$request->purpose,
                'unit_bind_status'=>1,
            ]);

                
                RotateDevice::whereIn('DeviceId',$request->unit_tag_id)
                ->update([
                        'status'=>1,
                       ]);

                 RotateDevice::where('DeviceId',$request->masterNumb)
                ->update([
                        'status'=>1,
                       ]);

        }
      }
        return redirect()->back()->with('success', 'Successfully Stored');

In my blade

                  <div class="form-group">
  <label>Purpose:</label>
  <select name="purpose" class="form-control select2"  data-placeholder="Select Purpose"
  style="width: 100%;">
  <option value="SALE">SALE</option>
  <option value="TEST" >DEMO/TEST</option>
  <option value="MAINTENANCE">MAINTENANCE</option>
</select>
<table class="table table-hover table-striped" id="tableSelectedItems" >
  <thead>
    <tr>
    <th>#</th>
              <th>D_Number</th>
              <th>Device_Type</th>
              <th>Brand_Name</th>
              <th>Manage</th>
    </tr>
  </thead>

  <tbody id="devicelist">
       @foreach($added_unit_to_issue as $key=>$dt)
            <tr>
              <input type="hidden" name="unit_id[]" value="{{$dt->id}}">
              <td>{{++$key}}</td>
              <td>{{$dt->devicenum}}</td>
              <td>
                @if($dt->devicetype == 1)
                 <small class="label bg-yellow">Master</small>
                 @else
                 <small class="label bg-green">Slave</small>
                 @endif
               </td>
              <td>{{$dt->deviceName}}</td>

              <td><a href="" data-id="{{$dt->id}}"  class="btn btn-danger btn-sm removeUnit">[-]</a></td>
            </tr>
            @endforeach
  </tbody>

someone can help me

0 likes
4 replies
melx's avatar
Level 4

this one $added_unit_to_issue if from index

melx's avatar
Level 4

@michaloravec your right, also this $request->unit_tag_id does supposed to be there i just removed as well.

Thank you cheers!

Please or to participate in this conversation.