Not sure what the NovaRequest class does, maybe you can use the regular Illuminate\Http\Request class?
Dec 14, 2022
6
Level 10
Set field default with url GET parameter
I'd like to set the default value for a field with a get paramter for my create form. For my field i use the default() method, but i can't access the initial get paramter (exmaple.com/contact/new?name=defaultName):
Text::make('Name', 'name')->default(function(NovaRequest $request) {
return $request->get('name');
}),
Any idea how i can set the default value by a get parameter?
Level 73
@DivDax Take a look at this example here: https://github.com/laravel/nova-issues/issues/1650#issuecomment-699612345
Seems like you are facing the same issue, so the code there should help.
Please or to participate in this conversation.