From a26eeb9441adba453db3005a82c640684a541740 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Mon, 7 Oct 2024 11:29:56 +0300 Subject: [PATCH] fix slug --- kernel/helpers/Slug.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel/helpers/Slug.php b/kernel/helpers/Slug.php index aab7264..0bde8c1 100644 --- a/kernel/helpers/Slug.php +++ b/kernel/helpers/Slug.php @@ -127,6 +127,11 @@ class Slug return $options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str; } + /** + * @param string $title + * @param $model + * @return string + */ public static function createSlug(string $title, $model = null): string { $slug = Slug::url_slug($title, ['transliterate' => true, 'lowercase' => true]); @@ -137,7 +142,14 @@ class Slug return Slug::recursiveCreateSlug($model, $slug); } - protected static function recursiveCreateSlug($model, string $slug, string $tmpSlug = '', int $id = 1): string + /** + * @param $model + * @param string $slug + * @param string $tmpSlug + * @param int $id + * @return string + */ + private static function recursiveCreateSlug($model, string $slug, string $tmpSlug = '', int $id = 1): string { if ($tmpSlug === '') $tmpSlug = $slug; if ($model::where(['slug' => $tmpSlug])->exists()) {