zaster
4 months ago
32
21
Laravel

Array to String Conversion Error

Posted 4 months ago by zaster
+request: ParameterBag {#43 ▼
    #parameters: array:6 [▼
      "_token" => "cQQv8KMaPeskjVq6GmspJz3SO4gh7PTe5yj0psrz"
      "dispatch_item_qty" => array:1 [▼
        3 => "5"
      ]

controller

foreach($sub_jobs as $sub_job)     
{                       
$sub_job->dispatches()->attach($dispatch_id, [array('qty'=> $request->dispatch_item_qty)]); 
}

As i understand, the value of dispatch_item_qty should be converted from a string to a numerical value

Please sign in or create an account to participate in this conversation.