64robots / nova-row
A Laravel Nova row field.
Installs: 4 398
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 2
Open Issues: 0
Language:Vue
Requires
- php: >=7.1.0
- 64robots/nova-fields: ^0.2
README
This field has been merged to Custom Nova Fields package. Keep track of it for updates!
Row Field for Laravel Nova
This field allows you to create horizontal rows passing a collection of Custom Nova Fields.
Demo
Install
Run this command in your nova project:
composer require 64robots/nova-fields
Add it to your Nova Resource:
Create a new Row field passing an array of Nova Fields as a second param. Attribute name can be passed as third param.
As we are using R64 Nova Fields. We can customize the classes and hide the field labels.
use R64\NovaFields\Row; Row::make('Lines', [ Number::make('Quantity') ->fieldClasses('w-full px-8 py-6') ->hideLabelInForms(), Text::make('Product') ->fieldClasses('w-full px-8 py-6') ->hideLabelInForms(), Number::make('Price') ->fieldClasses('w-full px-8 py-6') ->hideLabelInForms(), ])->fieldClasses('w-full px-8 py-6') ->labelClasses('w-1/2 px-8 py-6'),
This converts to an array of objects.
[ { quantity: 1, product: 'This One', price: 20 }, { quantity: 2, product: 'That One', price: 21 } ];
Localization
Set your translations in the corresponding xx.json file located in /resources/lang/vendor/nova
... "Add Row": "Añadir Fila", "Delete Row": "Eliminar Fila", "Are you sure you want to delete this row?": "¿Estás seguro de querer eliminar esta fila?"