Skip to content

Commit f64a4f8

Browse files
committed
wip
1 parent ed8f450 commit f64a4f8

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/Fields/Checkbox.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ class Checkbox extends Select
99
*/
1010
protected string $template = 'root::fields.checkbox';
1111

12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function multiple(bool $value = true): static
16+
{
17+
return $this;
18+
}
19+
20+
/**
21+
* {@inheritdoc}
22+
*/
23+
public function size(int $value): static
24+
{
25+
return $this;
26+
}
27+
1228
/**
1329
* {@inheritdoc}
1430
*/

src/Fields/Slug.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class Slug extends Text
3737
*/
3838
protected bool $nullable = false;
3939

40+
/**
41+
* Indicates if the slug should be generated always.
42+
*/
43+
protected bool $always = false;
44+
4045
/**
4146
* The slug resolver.
4247
*/
@@ -71,12 +76,22 @@ public function isNullable(): bool
7176
return $this->nullable;
7277
}
7378

79+
/**
80+
* Set the "always" property.
81+
*/
82+
public function alsways(bool $value = true): static
83+
{
84+
$this->always = $value;
85+
86+
return $this;
87+
}
88+
7489
/**
7590
* {@inheritdoc}
7691
*/
7792
public function persist(Request $request, Model $model, mixed $value): void
7893
{
79-
if (! $model->exists) {
94+
if (! $model->exists || $this->always) {
8095
$model->saved(function (Model $model) use ($request): void {
8196
$value = $this->generate($request, $model);
8297

0 commit comments

Comments
 (0)