1 | <?php |
||
5 | class SlugOptions |
||
6 | { |
||
7 | /** @var string|array|callable */ |
||
8 | public $generateSlugFrom; |
||
9 | |||
10 | /** @var string */ |
||
11 | public $slugField; |
||
12 | |||
13 | /** @var string */ |
||
14 | public $slugCustomField; |
||
15 | |||
16 | /** @var bool */ |
||
17 | public $generateUniqueSlugs = true; |
||
18 | |||
19 | /** @var bool */ |
||
20 | public $generateSlugIfAllSourceFieldsEmpty = true; |
||
21 | |||
22 | /** @var int */ |
||
23 | public $maximumLength = 251; |
||
24 | |||
25 | /** @var string */ |
||
26 | public $separator = '-'; |
||
27 | |||
28 | /** @var int */ |
||
29 | public $randomUrlLen = 50; |
||
30 | |||
31 | /** @var bool */ |
||
32 | public $slugifySlugSourceString = true;//if setted to false don't call Str::slug on the slug generated automatically |
||
33 | |||
34 | /** @var bool */ |
||
35 | public $slugifyCustomSlug = true;//if setted to false don't call Str::slug on the slug custom field |
||
36 | |||
37 | /** |
||
38 | * @return SlugOptions |
||
39 | */ |
||
40 | public static function create(): SlugOptions |
||
44 | |||
45 | /** |
||
46 | * @param bool $bool |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function slugifySourceString($bool) |
||
55 | |||
56 | /** |
||
57 | * @param bool $bool |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function slugifyCustomSlug($bool) |
||
66 | |||
67 | /** |
||
68 | * @param string|array|callable $fieldName |
||
69 | * |
||
70 | * @return \Padosoft\Sluggable\SlugOptions |
||
71 | */ |
||
72 | public function generateSlugsFrom($fieldName): SlugOptions |
||
78 | |||
79 | /** |
||
80 | * @param string $fieldName |
||
81 | * @return SlugOptions |
||
82 | */ |
||
83 | public function saveSlugsTo(string $fieldName): SlugOptions |
||
89 | |||
90 | /** |
||
91 | * @param string $fieldName |
||
92 | * @return SlugOptions |
||
93 | */ |
||
94 | public function saveCustomSlugsTo(string $fieldName): SlugOptions |
||
100 | |||
101 | public function allowDuplicateSlugs(): SlugOptions |
||
107 | |||
108 | public function disallowSlugIfAllSourceFieldsEmpty(): SlugOptions |
||
114 | |||
115 | public function allowSlugIfAllSourceFieldsEmpty(): SlugOptions |
||
121 | |||
122 | /** |
||
123 | * @param int $maximumLength |
||
124 | * @return SlugOptions |
||
125 | */ |
||
126 | public function slugsShouldBeNoLongerThan(int $maximumLength): SlugOptions |
||
132 | |||
133 | /** |
||
134 | * @param int $maximumLength |
||
135 | * @return SlugOptions |
||
136 | */ |
||
137 | public function randomSlugsShouldBeNoLongerThan(int $maximumLength): SlugOptions |
||
143 | |||
144 | /** |
||
145 | * @param string $separator |
||
146 | * @return SlugOptions |
||
147 | */ |
||
148 | public function slugsSeparator(string $separator): SlugOptions |
||
154 | |||
155 | /** |
||
156 | * Get the options for generating the slug. |
||
157 | */ |
||
158 | public function getSlugOptionsDefault(): SlugOptions |
||
178 | } |
||
179 |