Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 19, 2024
1 parent ed8f450 commit f64a4f8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Fields/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ class Checkbox extends Select
*/
protected string $template = 'root::fields.checkbox';

/**
* {@inheritdoc}
*/
public function multiple(bool $value = true): static
{
return $this;
}

/**
* {@inheritdoc}
*/
public function size(int $value): static
{
return $this;
}

/**
* {@inheritdoc}
*/
Expand Down
17 changes: 16 additions & 1 deletion src/Fields/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class Slug extends Text
*/
protected bool $nullable = false;

/**
* Indicates if the slug should be generated always.
*/
protected bool $always = false;

/**
* The slug resolver.
*/
Expand Down Expand Up @@ -71,12 +76,22 @@ public function isNullable(): bool
return $this->nullable;
}

/**
* Set the "always" property.
*/
public function alsways(bool $value = true): static

Check warning on line 82 in src/Fields/Slug.php

View workflow job for this annotation

GitHub Actions / 文A Typos check

"alsways" should be "always".
{
$this->always = $value;

return $this;
}

/**
* {@inheritdoc}
*/
public function persist(Request $request, Model $model, mixed $value): void
{
if (! $model->exists) {
if (! $model->exists || $this->always) {
$model->saved(function (Model $model) use ($request): void {
$value = $this->generate($request, $model);

Expand Down

0 comments on commit f64a4f8

Please sign in to comment.