Closed mohamadtsn closed 2 years ago
I like this ... except I think a simpler solution might be to change these lines in the existing code:
} elseif (is_callable($method)) {
$slug = $method($source, $separator);
to this:
} elseif (is_callable($method, true, $callable)) {
$slug = $callable($source, $separator);
Actually ... ignore my previous comment. The package already works using an array as the method
in config.
I tested by adding just your test files to the 9.0.0 version of the package and running the tests. They pass just fine.
To make a slug, you can use special methods and change its process. A Closure must be received to change this process. Also, Closure can be defined in
config/sluggable.php
file. Now the issue and the problem it causes is that when we want to cache the config files usingconfig:cache
command during the program execution in production mode. This is exactly the problem and the reason is that Closures cannot be cached.I hope I have contributed in a positive way to this practical package :shipit: Thank you!