@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $this->mergeConfigFrom(__DIR__.'/../config/eus.php', 'eus'); |
30 | 30 | |
31 | - $this->app->bind(\Fomvasss\LaravelEUS\Contracts\EUSGenerator::class, function () { |
|
31 | + $this->app->bind(\Fomvasss\LaravelEUS\Contracts\EUSGenerator::class, function() { |
|
32 | 32 | return new EUSGenerator($this->app); |
33 | 33 | }); |
34 | 34 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct($app = null) |
34 | 34 | { |
35 | - if (! $app) { |
|
36 | - $app = app(); //Fallback when $app is not given |
|
35 | + if (!$app) { |
|
36 | + $app = app(); //Fallback when $app is not given |
|
37 | 37 | } |
38 | 38 | $this->app = $app; |
39 | 39 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | protected function makeNonUniqueStr(string $rawStr): string |
153 | 153 | { |
154 | 154 | if ($str_allowed_separator = $this->config['str_allowed_separator']) { |
155 | - $res = array_map(function ($str) { |
|
155 | + $res = array_map(function($str) { |
|
156 | 156 | |
157 | 157 | return str_slug($this->getClippedSlugWithPrefixSuffix($str), $this->config['str_slug_separator']); |
158 | 158 | |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | { |
173 | 173 | $prefix = $this->config['prefix']; |
174 | 174 | $suffix = $this->config['suffix']; |
175 | - $maximumLength= $this->config['max_length']; |
|
175 | + $maximumLength = $this->config['max_length']; |
|
176 | 176 | |
177 | 177 | if ($strLen = strlen($prefix) + strlen($suffix)) { |
178 | 178 | $limitWithoutPrefixSuffix = $maximumLength - ($strLen + 2); |
179 | 179 | |
180 | 180 | if ($limitWithoutPrefixSuffix < 1) { |
181 | - return str_limit($prefix . ' ' . $suffix, $maximumLength); |
|
181 | + return str_limit($prefix.' '.$suffix, $maximumLength); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $prefix.' '.str_limit($str, $limitWithoutPrefixSuffix, '').' '.$suffix; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $i = 1; |
199 | 199 | |
200 | 200 | while ($this->isOtherRecordExists($str) || $str === '') { |
201 | - $str = $notUniqueStr . $this->config['str_slug_separator'] . $i++; |
|
201 | + $str = $notUniqueStr.$this->config['str_slug_separator'].$i++; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $str; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | return (bool) $modelClass::withoutGlobalScopes() |
219 | 219 | ->where($primaryKey, '<>', optional($this->entity)->{$primaryKey}) // except check self entity |
220 | 220 | ->where($fieldNameForUnique, $str) |
221 | - ->when($this->where, function ($q) { |
|
221 | + ->when($this->where, function($q) { |
|
222 | 222 | $q->where($this->where); |
223 | 223 | })->first(); |
224 | 224 | } |