@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'laracache'); |
19 | 19 | |
20 | - $this->app->bind('laracache', function () { |
|
20 | + $this->app->bind('laracache', function() { |
|
21 | 21 | return new LaraCache; |
22 | 22 | }); |
23 | 23 | } |
@@ -68,15 +68,12 @@ discard block |
||
68 | 68 | |
69 | 69 | if ($entity->forever) { |
70 | 70 | CacheFacade::store($driver)->forever($entity->name, $value); |
71 | - } |
|
72 | - else { |
|
71 | + } else { |
|
73 | 72 | if ($entity->validForRestOfDay) { |
74 | 73 | $ttl = Helpers::timeToEndOfDay(); |
75 | - } |
|
76 | - else if ($entity->validForRestOfWeek) { |
|
74 | + } else if ($entity->validForRestOfWeek) { |
|
77 | 75 | $ttl = Helpers::timeToEndOfWeek(); |
78 | - } |
|
79 | - else { |
|
76 | + } else { |
|
80 | 77 | $ttl = $entity->ttl; |
81 | 78 | } |
82 | 79 | |
@@ -84,12 +81,10 @@ discard block |
||
84 | 81 | } |
85 | 82 | |
86 | 83 | return $value; |
87 | - } |
|
88 | - else { |
|
84 | + } else { |
|
89 | 85 | return CacheFacade::store($driver)->get($entity->name, $entity->default); |
90 | 86 | } |
91 | - } |
|
92 | - else { |
|
87 | + } else { |
|
93 | 88 | throw new Exception("Cache entity [$name] not found. please check if [$name] exists in " . $this->model); |
94 | 89 | } |
95 | 90 | } |
@@ -104,8 +99,7 @@ discard block |
||
104 | 99 | |
105 | 100 | if ($value) { |
106 | 101 | return $value; |
107 | - } |
|
108 | - else { |
|
102 | + } else { |
|
109 | 103 | return $this->updateCacheEntity($name, '', $entity); |
110 | 104 | } |
111 | 105 | } |
@@ -120,8 +114,7 @@ discard block |
||
120 | 114 | if ($this->model::$isEnabled) { |
121 | 115 | if ($this->isQueueable()) { |
122 | 116 | RefreshCache::dispatch($model, $event); |
123 | - } |
|
124 | - else { |
|
117 | + } else { |
|
125 | 118 | foreach ($this->model::cacheEntities() as $entity) { |
126 | 119 | $this->updateCacheEntity($entity->name, $event, $entity); |
127 | 120 | } |