Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Feb 3, 2025
1 parent f641d29 commit f14762f
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/support/src/Concerns/HasCellState.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,20 @@ public function queriesRelationships(Model $record): bool
return $this->hasRelationship($record);
}

public function getRelationship(Model $record, ?string $name = null): ?Relation
public function getRelationship(Model $record, ?string $relationshipName = null): ?Relation
{
$name ??= $this->getName();
if (isset($relationshipName)) {
$nameParts = explode('.', $relationshipName);
} else {
$name = $this->getName();

if (! str($name)->contains('.')) {
return null;
}
if (! str($name)->contains('.')) {
return null;
}

$nameParts = explode('.', $name);
array_pop($nameParts);
$nameParts = explode('.', $name);
array_pop($nameParts);
}

$relationship = null;

Expand Down Expand Up @@ -241,9 +245,9 @@ public function getRelationshipResults(Model $record, ?array $relationships = nu
return $results;
}

public function getAttributeName(Model $record, ?string $name = null): string
public function getAttributeName(Model $record): string
{
$name ??= $this->getName();
$name = $this->getName();

if (! str($name)->contains('.')) {
return $name;
Expand All @@ -262,9 +266,9 @@ public function getAttributeName(Model $record, ?string $name = null): string
return Arr::first($nameParts);
}

public function getFullAttributeName(Model $record, ?string $name = null): string
public function getFullAttributeName(Model $record): string
{
$name ??= $this->getName();
$name = $this->getName();

if (! str($name)->contains('.')) {
return $name;
Expand Down Expand Up @@ -330,9 +334,9 @@ public function getInverseRelationshipName(Model $record): string
return implode('.', $inverseRelationshipParts);
}

public function getRelationshipName(Model $record, ?string $name = null): ?string
public function getRelationshipName(Model $record): ?string
{
$name ??= $this->getName();
$name = $this->getName();

if (! str($name)->contains('.')) {
return null;
Expand Down

0 comments on commit f14762f

Please sign in to comment.