1 | <?php |
||||
2 | |||||
3 | namespace Raystech\StarterKit\Traits; |
||||
4 | |||||
5 | use Illuminate\Database\Eloquent\Builder; |
||||
6 | use Illuminate\Database\Eloquent\Collection; |
||||
7 | use Illuminate\Database\Eloquent\Model; |
||||
8 | use Illuminate\Database\Eloquent\Relations\MorphMany; |
||||
9 | use Illuminate\Database\Query\JoinClause; |
||||
10 | use Cocur\Slugify\Slugify; |
||||
11 | |||||
12 | trait CustomSlugify |
||||
13 | { |
||||
14 | |||||
15 | /* |
||||
16 | * Rerurn slug string with support TH language |
||||
17 | */ |
||||
18 | private function slugify_th($string, $separator) |
||||
19 | { |
||||
20 | $string = trim($string); |
||||
21 | $string = mb_strtolower($string, 'UTF-8'); |
||||
22 | |||||
23 | // Make alphanumeric (removes all other characters) |
||||
24 | // this makes the string safe especially when used as a part of a URL |
||||
25 | // this keeps latin characters and Persian characters as well |
||||
26 | $string = preg_replace("/[^a-z0-9_\s-ๅภถุึคตจขชๆไำพะัีรนยบลฃฟหกดเ้่าสวงผปแอิืทมใฝูฎฑธ๊ณญฐฅฤฆฏโฌ็๋ษศซฉฮ์ฒฬฦ]/u", '', $string); |
||||
27 | |||||
28 | // Remove multiple dashes or whitespaces or underscores |
||||
29 | $string = preg_replace("/[\s-_]+/", ' ', $string); |
||||
30 | |||||
31 | // Convert whitespaces and underscore to the given separator |
||||
32 | $string = preg_replace("/[\s_]/", $separator, $string); |
||||
33 | |||||
34 | return $string; |
||||
35 | } |
||||
36 | |||||
37 | public function customizeSlugEngine(Slugify $engine, $attribute) |
||||
0 ignored issues
–
show
The parameter
$engine is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
38 | { |
||||
39 | $reg_str = '/([^A-Za-z0-9ภถุึคตจขชๆไำพะัีรนยบลฃฟหกดเ้่าสวงผปแอิืทมใฝูฎฑธ๊ณญฐฅฤฆฏโฌ็๋ษศซฉฮ์ฒฬฦ]|-)+/'; |
||||
40 | $engine = new Slugify(['regexp' => $reg_str]); |
||||
41 | return $engine; |
||||
42 | } |
||||
43 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.