Laravel with POSTGRESS . You might need to add an explicit type cast error, operator does not exist:

Viewed 123

I switched my database from Mysql to Postgress and now I'm getting the above error after switching.

My function looks like this.

public function viewRunDetails(Run_List $id) {
    $this->viewRun = $id->id;
    $profile = Profile::where('id', $id->profile_id)->first();
    $runnerlist = Runners_List::where('run_list_id', $id->id)->get();
    $pace = $runnerlist->sum('distance');
    $TotalPace = Runners_List::where('run_list_id', $id->id)->selectRaw('SEC_TO_TIME( SUM( 
        TIME_TO_SEC( `pace` ) ) / ?) as total', [$pace])->first();
    $variable = substr($TotalPace->total, 0, strpos($TotalPace->total, "."));
}

distance is in the decimal format while the pace is in time format.

Specifically, I'm getting the error here

$TotalPace = Runners_List::where('run_list_id', $id->id)->selectRaw('SEC_TO_TIME( SUM( 
        TIME_TO_SEC( `pace` ) ) / ?) as total', [$pace])->first();

Any ideas why it's showing that error? Thanks.

0 Answers
Related