Skip to content

Commit

Permalink
Fourth time's a charm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Feb 27, 2024
1 parent d02be48 commit 5f8dd26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
14 changes: 1 addition & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.5.4] - 27-02-2024

### Changed

- Fixed issue with (soft-)deleted models throwing an exception when rendering field

## [4.5.3] - 27-02-2024

### Changed

- Fixed issue with (soft-)deleted models throwing an exception when rendering field

## [4.5.2] - 27-02-2024
## [4.5.5] - 27-02-2024

### Changed

Expand Down
4 changes: 3 additions & 1 deletion src/Traits/MultiselectBelongsToSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ public function belongsTo($resourceClass, $async = true)
)->limit(1000)->get();
}

$models = $models->filter()->values();

$this->setOptionsFromModels($models, $resourceClass);

$resource = isset($value) ? new $resourceClass($models->first()) : null;
$resource = isset($value) && $models->count() > 0 ? new $resourceClass($models->first()) : null;
$this->withMeta([
'belongsToDisplayValue' => $resource ? (string) $resource->title() : null,
'belongsToResourceName' => $resource ? $resource::uriKey() : null,
Expand Down

0 comments on commit 5f8dd26

Please sign in to comment.