Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined variable $model #6501

Closed
guoxiangke opened this issue Aug 15, 2024 · 4 comments
Closed

Undefined variable $model #6501

guoxiangke opened this issue Aug 15, 2024 · 4 comments
Labels
needs more info More information is required stale

Comments

@guoxiangke
Copy link

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
Copy link
Member

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)

@crynobone crynobone added the needs more info More information is required label Aug 15, 2024
@guoxiangke
Copy link
Author

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
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is required stale
Projects
None yet
Development

No branches or pull requests

2 participants