I'm setting up a new website, i have this cron job script to automatically update all investment
Error seems to be coming from http controller (line: $rLog['amount'] = round(($rep->invest->amount * $rep->invest->plan->percent) / 100,$basic->deci);
).
But i have no idea how to fix it because am totally new to laravel
if ($basic->repeat_status == 1){
$repeats = Repeat::whereStatus(0)->get();
foreach ($repeats as $rep){
if ($rep->repeat_time < Carbon::now()){
$rLog['user_id'] = $rep->user_id;
$rLog['trx_id'] = strtoupper(Str::random(20));
$rLog['investment_id'] = $rep->investment_id;
$rLog['made_time'] = Carbon::now();
$rLog['amount'] = round(($rep->invest->amount * $rep->invest->plan->percent) / 100,$basic->deci);
RepeatLog::create($rLog);
$rep->total_repeat = $rep->total_repeat + 1;
$rep->made_time = Carbon::now();
$rep->repeat_time = Carbon::parse()->addHours($rep->invest->plan->compound->compound);
if ($rep->total_repeat == $rep->invest->plan->time){
$rep->status = 1;
$inv = Investment::findOrFail($rep->investment_id);
$inv->status = 1;
$inv->save();
}
$rep->save();
I expect the cron job script to run and result should be an update in the original investment by user