Skip to content

Commit

Permalink
fix: save parent relationship with tenancy
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Frey <[email protected]>
  • Loading branch information
lukas-frey committed Mar 18, 2024
1 parent 7f39817 commit b991057
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Pages/CreateRelatedRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ protected function handleRecordCreation(array $data): Model
{
$record = new ($this->getRelation()->getRelated())($data);

if ($owner = $this->getOwnerRecord()) {
$record = $this->associateRecordWithParent($record, $owner);
}

if (
static::getResource()::isScopedToTenant() &&
($tenant = Filament::getTenant())
) {
return $this->associateRecordWithTenant($record, $tenant);
}

if ($owner = $this->getOwnerRecord()) {
$record = $this->associateRecordWithParent($record, $owner);
}
$record->save();

return $record;
Expand Down

0 comments on commit b991057

Please sign in to comment.