@@ 228-244 (lines=17) @@ | ||
225 | * |
|
226 | * @return \Cocur\Slugify\Slugify |
|
227 | */ |
|
228 | protected function getSlugEngine(string $attribute): Slugify |
|
229 | { |
|
230 | static $slugEngines = []; |
|
231 | ||
232 | $key = get_class($this->model) . '.' . $attribute; |
|
233 | ||
234 | if (!array_key_exists($key, $slugEngines)) { |
|
235 | $engine = new Slugify(); |
|
236 | if (method_exists($this->model, 'customizeSlugEngine')) { |
|
237 | $engine = $this->model->customizeSlugEngine($engine, $attribute); |
|
238 | } |
|
239 | ||
240 | $slugEngines[$key] = $engine; |
|
241 | } |
|
242 | ||
243 | return $slugEngines[$key]; |
|
244 | } |
|
245 | ||
246 | /** |
|
247 | * Checks that the given slug is not a reserved word. |
@@ 214-230 (lines=17) @@ | ||
211 | * |
|
212 | * @return \Cocur\Slugify\Slugify |
|
213 | */ |
|
214 | protected function getSlugEngine(string $attribute): Slugify |
|
215 | { |
|
216 | static $slugEngines = []; |
|
217 | ||
218 | $key = get_class($this->model) . '.' . $attribute; |
|
219 | ||
220 | if (!array_key_exists($key, $slugEngines)) { |
|
221 | $engine = new Slugify(); |
|
222 | if (method_exists($this->model, 'customizeSlugEngine')) { |
|
223 | $engine = $this->model->customizeSlugEngine($engine, $attribute); |
|
224 | } |
|
225 | ||
226 | $slugEngines[$key] = $engine; |
|
227 | } |
|
228 | ||
229 | return $slugEngines[$key]; |
|
230 | } |
|
231 | ||
232 | /** |
|
233 | * Checks that the given slug is not a reserved word. |