I have an if/else statement inside of an elseif statement that is causing the following issue "syntax error, unexpected '{'"
. Here is the code causing the problem:
$calendar = json_decode($calendarapi);
if(isset($calendar->id) && $calendar->status != 'cancelled'){
$returnvalues['id'] = $calendar->id;
$returnvalues['success'] = true;
return $returnvalues;
}
elseif($calendar->status == 'cancelled'){
$calendarapi = $this->GoogleCalendarAdd($request, $request, $calendarDescription, $startDateTime, $endDateTime);
$calendar = json_decode($calendarapi);
if(isset($calendar->id){ //Error Happens here
$basic['OldSchedule']->calendar_id = $calendar->id;
$basic['OldSchedule']->save();
$returnvalues['success'] = true;
return $returnvalues;
}else{
$returnvalues['success'] = false;
return $returnvalues;
}
}
I have looked over it a couple dozen times, but I can't figure out where I went wrong. All semicolons are where they are supposed to be. My code editor, Atom, shows that the if/else statement are nested inside the elseif statement, so I am out of things that could be causing the error.