Specify condition in script in laravel

enter image description here

I have pasted the complete code of script:

 <script>
     var SITEURL = "{{ url('/') }}";
      var today = moment();
      $('#calendar').fullCalendar({
                     defaultView: 'week',
      
                      visibleRange: {
                      start: moment('<? echo $dateFrom;?>T00:00:00'),
                      end: moment('<? echo $dateTo;?>T24:00:00')
                    } ,
                    header: {
                        
                        left: '',
                        center: 'title',
                        right: ''
                      },
                    
                    editable: true,
                    eventLimit: true, // allow "more" link when too many events
                    schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
                       views: {
                        week: {
                           
                             type: 'timeline',
                            slotLabelInterval: { hours: 24},
                            slotDuration: { hours: 24},
                        }
                    },                
                    resourceLabelText: 'Time Slot',
                  
                    resources: [
                        
                        { id: '1', title: '08:00 - 08:30' , eventColor: 'green'},
                        { id: '2', title: '08:30 - 09:00', eventColor: 'green' },
                        { id: '3', title: '09:00 - 09:30', eventColor: 'green'  },
                        { id: '4', title: '09:30 - 10:00', eventColor: 'green'},
                        { id: '5', title: '10:30 - 11:00', eventColor: 'green' },
                        { id: '6', title: '11:30 - 12:00', eventColor: 'green'},
                        { id: '7', title: '12:30 - 13:00', eventColor: 'green' },
                        { id: '8', title: '13:30 - 14:00', eventColor: 'green'},
                        { id: '9', title: '14:30 - 15:00', eventColor: 'green' },
                        { id: '10', title: '15:30 - 16:00', eventColor: 'green'},
                        { id: '11', title: '16:30 - 17:00', eventColor: 'green' },
                        { id: '12', title: '17:30 - 18:00', eventColor: 'green'},
                        { id: '13', title: '18:30 - 19:00', eventColor: 'green' },
                        
                        ],
      
                    events: [
                      <?php
         
           foreach ($data as $sl => $valuegm){
             
  
         ?>
                      { id: '<?php echo $valuegm->id; ?>', 
                      resourceId: '<?php echo $valuegm->timeslot_id; ?>',
                      start: '<?php echo $valuegm->date; ?>',
                      end: '<?php echo $valuegm->date;?>', title: '',
                      description: '<?php if(!$valuegm->doctor_id==null)
                      {echo "<b>".$valuegm->get_doctor->name."</b><br/>".$valuegm->get_doctor->get_specialty->name."<br/>
                      Mobile:".$valuegm->get_doctor->mobile."<br/>
                      Address:".$valuegm->get_doctor->address."<br/>";?><? if(!$valuegm->get_doctor->email==null)
                      { echo "Email:".$valuegm->get_doctor->email."<br/>";}?>
                      <? echo "City:".$valuegm->get_doctor->get_city->description."<br/>";?>
                      <? if(!$valuegm->get_doctor->area_id==null){ echo "Area:".$valuegm->get_doctor->get_area->name."<br/>";}?>
                      <?}else{echo "<b>".$valuegm->get_pharmacy->name."</b><br/>Mobile:".$valuegm->get_pharmacy->mobile."<br/>
                      Address:".$valuegm->get_pharmacy->address."<br/>";?>
                      <? if(!$valuegm->get_pharmacy->email==null){ echo "Email:".$valuegm->get_pharmacy->email."<br/>";}?>
                      <? echo "City:".$valuegm->get_pharmacy->get_city->description."<br/>";?>
                      <? if(!$valuegm->get_pharmacy->area_id==null){ echo "Area:".$valuegm->get_pharmacy->get_area->name."<br/>";}?><?}?>
                      
                    
                    
                    
                      
                      <?php $f = $valuegm->rating; if ($f == 1) { echo "Rating: Positive"; } elseif ($f == 2) { echo "Rating: Netural"; }elseif ($f == 3) { echo "Rating: Negative"; }?>
                      
                      
                    
                    
                    
                      
                      <?php echo "<p>".$valuegm->feedback."</p>";?><br/>',url: SITEURL + '/search/<?php echo $valuegm->id;?>/<?php echo $dateFrom;?>/<?php echo $dateTo;?>'},
                      <?php }?>],
                      
                                          
        eventRender: function(event, element) { 
            element.find('.fc-title').append("<br/>" + event.description ); 
            
        } 
      
                });
   </script>
  

Actually i am working with this part : if the doctor review is positive then background color should be green ,if the doctor review is negative then background color should be red. but now we have specifyed as green. Actually i am working with how to specify the background color based on the feedback of the customer in this below code.

resources: [

                    { id: '1', title: '08:00 - 08:30' , eventColor: 'green'},
                    { id: '2', title: '08:30 - 09:00', eventColor: 'green' },
                    { id: '3', title: '09:00 - 09:30', eventColor: 'green'  },
                    { id: '4', title: '09:30 - 10:00', eventColor: 'green'},
                    { id: '5', title: '10:30 - 11:00', eventColor: 'green' },
                    { id: '6', title: '11:30 - 12:00', eventColor: 'green'},
                    { id: '7', title: '12:30 - 13:00', eventColor: 'green' },
                    { id: '8', title: '13:30 - 14:00', eventColor: 'green'},
                    { id: '9', title: '14:30 - 15:00', eventColor: 'green' },
                    { id: '10', title: '15:30 - 16:00', eventColor: 'green'},
                    { id: '11', title: '16:30 - 17:00', eventColor: 'green' },
                    { id: '12', title: '17:30 - 18:00', eventColor: 'green'},
                    { id: '13', title: '18:30 - 19:00', eventColor: 'green' },

                    ],

i have specifyed the particular line for fetching review(please refer the complete code for
better understanding). please try figure out this:

              <?php $f = $valuegm->rating; if ($f == 1) { echo "Rating: Positive"; } elseif ($f == 2) { echo "Rating: Netural"; }elseif ($f == 3) { echo "Rating: Negative"; }?>