Skip to content

Commit

Permalink
Merge pull request #1535 from moonshine-software/disable-outside-has-…
Browse files Browse the repository at this point in the history
…many

feat: HasMany -> disableOutside
  • Loading branch information
lee-to authored Feb 15, 2025
2 parents 89be742 + 8413a04 commit 6ce5fa6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Laravel/src/Fields/Relationships/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class HasMany extends ModelRelationField implements HasFieldsContract, FieldWith

protected null|TableBuilderContract|FormBuilderContract|ActionButtonContract $resolvedComponent = null;

public function disableOutside(): static
{
$this->outsideComponent = false;

return $this->searchable(false);
}

public function withoutModals(): static
{
$this->withoutModals = true;
Expand Down Expand Up @@ -258,6 +265,10 @@ public function searchable(Closure|bool|null $condition = null): static
{
$this->isSearchable = value($condition, $this) ?? true;

if($this->isOutsideComponent()) {
$this->isSearchable = false;
}

return $this;
}

Expand Down

0 comments on commit 6ce5fa6

Please sign in to comment.