Skip to content

Commit

Permalink
feat: some flexible mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed May 10, 2024
1 parent 8885c35 commit 354e6f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/Endpoint/Concerns/IncludesData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ public function defaultInclude(array $include): static
return $this;
}

public function addDefaultInclude(array $include): static
{
$this->defaultInclude = array_merge($this->defaultInclude ?? [], $include);

return $this;
}

public function removeDefaultInclude(array $include): static
{
$this->defaultInclude = array_diff($this->defaultInclude ?? [], $include);

return $this;
}

private function getInclude(Context $context): array
{
if (
Expand Down
4 changes: 2 additions & 2 deletions src/Schema/Field/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function type(string|array $type): static
/**
* Allow this relationship to be included.
*/
public function includable(): static
public function includable(bool $includable = true): static
{
$this->includable = true;
$this->includable = $includable;

return $this;
}
Expand Down

0 comments on commit 354e6f5

Please sign in to comment.