Closed alies-dev closed 1 year ago
The Heading field doesn't support computed usage, will consider throwing exception in upcoming version.
@crynobone thanks! That also means we need to update PHPDoc, in the current version it's confusing:
/**
* @method static static make(mixed $name, string|null $attribute = null, callable|null $resolveCallback = null)
*/
class Heading extends Field implements Unfillable
``
ResolvingCallback isn't ComputedCallback.
@crynobone
ResolvingCallback isn't ComputedCallback.
I know, but this code also doesn't work as expected:
Heading::make('Computed heading (label)', null, function () {
return 'Computed heading (value)';
}),
it sets $resolveCallback, but it's never used on frontend. That's why I called it "confusing"
closing because:
The Heading field doesn't support computed usage, will consider throwing exception in upcoming version.
Related issue: https://github.com/laravel/nova-issues/issues/2685
Description:
It's not possible to use computed fields with
Heading
field type. I tried different approaches:nothing works. The issue is in
\Laravel\Nova\Fields\Heading::__construct
: we need to remove$this->withMeta(['value' => $name]);
lineWhy do I need it: prevent heavy value computing on index page (I need to compute this value for details page only)