laravel / nova-issues

556 stars 34 forks source link

Undefined variable $model #6501

Closed guoxiangke closed 2 months ago

guoxiangke commented 3 months ago

hi, I use

Text::make('Name', 'name') ->fillUsing(function ($request, $model, $attribute, $requestAttribute) { $model->{$attribute} = Str::title($request->input($attribute)); }),

but it said Undefined variable $model. Where can I get current $model? what if this is a create page? thanks.

crynobone commented 3 months ago

Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

guoxiangke commented 3 months ago

In the document(Field Hydration): https://nova.laravel.com/docs/resources/fields.html#field-hydration it's provide a $model in the fillUsing function. I just wonder what if create a new entity of a model, but the $model still not exist.

crynobone commented 3 months ago

Still need the reproducing repository as I have no idea why it isn't working on your usage, also we don't have any other report regarding this widely used feature.

crynobone commented 2 months ago

Hey there,

We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.