Skip to content

Commit

Permalink
added the ability to use resolveRelationUsing and still use the package
Browse files Browse the repository at this point in the history
  • Loading branch information
danilogiacomi authored and lindyhopchris committed Jun 26, 2024
1 parent a448802 commit 12c4116
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Fields/Relations/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function fill(Model $model, ?array $identifier): void
{
$name = $this->relationName();

assert(method_exists($model, $name), sprintf(
assert(method_exists($model, $name) || $model->relationResolver($model::class, $name), sprintf(
'Expecting method %s to exist on model %s.',
$name,
$model::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function getRelation(Model $model): EloquentBelongsToMany
{
$name = $this->relationName();

assert(method_exists($model, $name), sprintf(
assert(method_exists($model, $name) || $model->relationResolver($model::class, $name), sprintf(
'Expecting method %s to exist on model %s.',
$name,
$model::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Relations/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private function getRelation(Model $model): EloquentHasMany|EloquentMorphMany
{
$name = $this->relationName();

assert(method_exists($model, $name), sprintf(
assert(method_exists($model, $name) || $model->relationResolver($model::class, $name), sprintf(
'Expecting method %s to exist on model %s.',
$name,
$model::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Relations/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function fill(Model $model, ?array $identifier): void
{
$name = $this->relationName();

assert(method_exists($model, $name), sprintf(
assert(method_exists($model, $name) || $model->relationResolver($model::class, $name), sprintf(
'Expecting method %s to exist on model %s.',
$name,
$model::class,
Expand Down
2 changes: 1 addition & 1 deletion src/QueryToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private function getRelation(): EloquentRelation
{
$name = $this->relation->relationName();

assert(method_exists($this->model, $name), sprintf(
assert(method_exists($this->model, $name) || $this->model->relationResolver($this->model::class, $name), sprintf(
'Expecting method %s to exist on model %s',
$name,
$this->model::class,
Expand Down
2 changes: 1 addition & 1 deletion src/QueryToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private function getRelation(): EloquentRelation
{
$name = $this->relation->relationName();

assert(method_exists($this->model, $name), sprintf(
assert(method_exists($this->model, $name) || $this->model->relationResolver($this->model::class, $name), sprintf(
'Expecting method %s to exist on model %s',
$name,
$this->model::class,
Expand Down

0 comments on commit 12c4116

Please sign in to comment.