Skip to content

Commit 950a0e9

Browse files
committed
wip
1 parent 705facd commit 950a0e9

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Fields/File.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ public function collection(string $value): static
102102
public function resolveDisplay(Model $related): ?string
103103
{
104104
if (is_null($this->displayResolver)) {
105-
$this->display(fn (Medium $related): string => $related->isImage
106-
? sprintf('<img src="%s" width="40" height="40" alt="%s">', $related->getUrl($this->displayConversion), $related->name)
107-
: $related->file_name);
105+
$this->display(function (Medium $related): string {
106+
return $related->isImage
107+
? sprintf(
108+
'<img src="%s" width="40" height="40" alt="%s">',
109+
$related->getUrl($this->displayConversion), $related->name
110+
)
111+
: $related->file_name;
112+
});
108113
}
109114

110115
return parent::resolveDisplay($related);
@@ -117,7 +122,7 @@ public function formatRelated(Request $request, Model $model, Model $related): ?
117122
{
118123
$value = $this->resolveDisplay($related);
119124

120-
if ($related->isImage || ! $this->resolveAbility('view', $request, $model, $related)) {
125+
if (! $this->resolveAbility('view', $request, $model, $related)) {
121126
return $value;
122127
}
123128

src/Fields/Relation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ public function resolveAbility(string $ability, Request $request, Model $model,
843843
$ability .= Str::of($this->getModelAttribute())->singular()->studly()->value();
844844

845845
return is_null($policy)
846-
|| ! method_exists($policy, $ability)
846+
|| ! is_callable([$policy, $ability])
847847
|| Gate::allows($ability, [$model, ...$arguments]);
848848
}
849849

src/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Root
2525
*
2626
* @var string
2727
*/
28-
public const string VERSION = '2.6.4';
28+
public const string VERSION = '2.6.5';
2929

3030
/**
3131
* The registered booting callbacks.

0 commit comments

Comments
 (0)