Skip to content

Commit

Permalink
Revert "Throw exception if relationship not found"
Browse files Browse the repository at this point in the history
This reverts commit 903c8cf.
  • Loading branch information
howdu committed Dec 9, 2024
1 parent c4ad0c1 commit ec4eac4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/tables/src/Grouping/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Carbon\Carbon;
use Carbon\CarbonInterface;
use Closure;
use Exception;
use Filament\Support\Components\Component;
use Filament\Support\Contracts\HasLabel as LabelInterface;
use Filament\Tables\Table;
Expand Down Expand Up @@ -413,11 +412,9 @@ public function getRelationship(Model $record, ?string $name = null): ?Relation
return null;
}

$relationshipName = $name ?? $this->getRelationshipName();

$relationship = null;

foreach (explode('.', $relationshipName) as $nestedRelationshipName) {
foreach (explode('.', $name ?? $this->getRelationshipName()) as $nestedRelationshipName) {
if (! $record->isRelation($nestedRelationshipName)) {
$relationship = null;

Expand All @@ -428,10 +425,6 @@ public function getRelationship(Model $record, ?string $name = null): ?Relation
$record = $relationship->getRelated();
}

if (! $relationship) {
throw new Exception("The relationship [{$relationshipName}] does not exist on the model [{$record}].");
}

return $relationship;
}

Expand Down

0 comments on commit ec4eac4

Please sign in to comment.