I have a working function, but suddenly it now prompts an error.
at HandleExceptions->handleError(2, 'A non-numeric value encountered', 'C:\xampp\htdocs\fdis-laravel\app\Receivable.php', 67, array('receivable_payment_head_id' => null, 'total_receivable' => '936.341')) in Receivable.php line 67
Here's my code using DB:Raw.
<?php
public static function updateLessPaymentHead($receivable_payment_head_id, $total_receivable)
{
$payment_head = DB::table('receivables_payment_head')
->where('id', $receivable_payment_head_id)
->update(
['total_receivables' => DB::raw('total_receivables' - $total_receivable),
'total_payment' => DB::raw('total_payment' - $total_receivable),
]);
return $payment_head;
}
Is there a way that I can address the non-numeric issue with DB:raw or do I need to first convert this to numeric before updating? I'm using Laravel 5.4 and PHP 7.1.
'total_receivables' - $total_receivable? - Supun Praneeth