I have a select field in my resource that looks like this:
Select::make('Category', 'category')->options([
'local' => 'Local',
'ftp' => 'FTP',
]),
Now I want to display an other field based on the value a user selects in the Category field.
This is my goal:
NovaJsonSchemaField::make('Properties', $this->schema($category))
->listClass('list-reset'),
private function schema($category): array
{
$allSchemas = [
'ftp' => [
'type' => 'object',
'required' => [
'foo',
'bar',
],
'properties' => [
'foo' => [
'type' => 'string',
],
'bar' => [
'type' => 'string',
],
],
],
];
return $allSchemas[$category];
}
But I don't know how I can fill up my $category variable with the selected category.
I don't find any information on this in the Nova documentation.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/312ZmWo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire