Browse Source

fixed when no schedules (null)

tags/v1.0.1^0
Robin Thoni 8 years ago
parent
commit
8f9fe26653
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      app/Business/SchedulesBusiness.php

+ 9
- 7
app/Business/SchedulesBusiness.php View File

93
                 throw $e;
93
                 throw $e;
94
             }
94
             }
95
         }
95
         }
96
-        $schedules = static::getSchedulesForDate($data["data"]["schedules"], $date);
97
 
96
 
98
         $schedulesCarbon = [];
97
         $schedulesCarbon = [];
99
-
100
-        for ($i = 0; $i < count($schedules) && $count > 0; ++$i) {
101
-            $scheduleDate = Carbon::createFromFormat(static::$timeFormat . " " . static::$dateFormat, $schedules[$i] . " " . $date->toDateString());
102
-            if ($scheduleDate->gte($date)) {
103
-                --$count;
104
-                $schedulesCarbon[] = $scheduleDate;
98
+        if (!is_null($data["data"]["schedules"])) {
99
+            $schedules = static::getSchedulesForDate($data["data"]["schedules"], $date);
100
+
101
+            for ($i = 0; $i < count($schedules) && $count > 0; ++$i) {
102
+                $scheduleDate = Carbon::createFromFormat(static::$timeFormat . " " . static::$dateFormat, $schedules[$i] . " " . $date->toDateString());
103
+                if ($scheduleDate->gte($date)) {
104
+                    --$count;
105
+                    $schedulesCarbon[] = $scheduleDate;
106
+                }
105
             }
107
             }
106
         }
108
         }
107
 
109
 

Loading…
Cancel
Save