64robots/nova-row

A Laravel Nova row field.


Keywords
nova, laravel
License
MIT

Documentation

Row Field for Laravel Nova

This field allows you to create horizontal rows passing a collection of Custom Nova Fields.

Demo

Demo

Install

Run this command in your nova project: composer require 64robots/nova-row

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\NovaRow\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?"