-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow constraining relationship queries (#103)
* feat: allow constraining `ToMany` query * Run Prettier * chore: eloquent-specific relationships * Run Prettier --------- Co-authored-by: SychO9 <[email protected]>
- Loading branch information
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Tobyz\JsonApiServer\Laravel\Field\Concerns; | ||
|
||
use Closure; | ||
|
||
trait ScopesRelationship | ||
{ | ||
public ?Closure $scope = null; | ||
|
||
public function scope(?Closure $scope): static | ||
{ | ||
$this->scope = $scope; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Tobyz\JsonApiServer\Laravel\Field; | ||
|
||
use Tobyz\JsonApiServer\Schema\Field\ToMany as BaseToMany; | ||
|
||
class ToMany extends BaseToMany | ||
{ | ||
use Concerns\ScopesRelationship; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Tobyz\JsonApiServer\Laravel\Field; | ||
|
||
use Tobyz\JsonApiServer\Schema\Field\ToOne as BaseToOne; | ||
|
||
class ToOne extends BaseToOne | ||
{ | ||
use Concerns\ScopesRelationship; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters