Skip to content

Commit 9171d5b

Browse files
committed
Updated with instructions to pass additional options
1 parent bd89870 commit 9171d5b

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,34 @@ class Employee extends Model implements MappableRelationships
230230

231231
You can pass on following items for your related model's attributes:-
232232
1. `component`: The component use to render the field. You should provide the component name specified in the field like Text::class, Number::class, Boolean::class and so on.
233-
3. `label`: Label for your field. This will also be used as the field name in error messages.
234-
4. `rules`: A rule string in [Laravel Validation format](https://laravel.com/docs/5.8/validation#available-validation-rules).
235-
5. `messages`: An array of error messages to be used in validation.
236-
6. `placeholder`: A placeholder for your field.
233+
2. `label`: Label for your field. This will also be used as the field name in error messages.
234+
3. `rules`: A rule string in [Laravel Validation format](https://laravel.com/docs/5.8/validation#available-validation-rules).
235+
4. `messages`: An array of error messages to be used in validation.
236+
5. `placeholder`: A placeholder for your field.
237+
6. `options`: Additional options for your components
238+
239+
### Select Component
240+
To pass dropdown options to your select component, pass an array of key values to options
241+
```php
242+
'component => Select::class,
243+
'options' => [
244+
'options' => [
245+
['label' => 'Yes', 'value' => true],
246+
['label' => 'No', 'value' => false],
247+
],
248+
]
249+
```
250+
251+
### Number/Currency Component
252+
You can pass `min`, `max` and `step` to number and currency field
253+
```php
254+
'component' => Currency::class,
255+
'options' => [
256+
'min' => 0,
257+
'max' => 100,
258+
'step' => 10,
259+
],
260+
```
237261

238262
## Supported fields
239263

@@ -258,7 +282,7 @@ You can use any field you can add to your Nova resource with `Field::make` synta
258282
- Image Field
259283
- File Field
260284

261-
**_NOTE:_** You can pass any additional arguments (like options for your select field) with your settings map.
285+
**_NOTE:_** You can pass any additional arguments (like options for your select field) with your settings map using `options`.
262286

263287
## Things to Fix
264288

0 commit comments

Comments
 (0)