https://github.com/outl1ne/nova-table-field
Table field for Laravel Nova
https://github.com/outl1ne/nova-table-field
laravel laravel-nova laravel-nova-field
Last synced: 2 months ago
JSON representation
Table field for Laravel Nova
- Host: GitHub
- URL: https://github.com/outl1ne/nova-table-field
- Owner: outl1ne
- License: mit
- Created: 2020-08-21T14:29:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T14:03:26.000Z (over 1 year ago)
- Last Synced: 2025-04-13T04:12:53.716Z (2 months ago)
- Topics: laravel, laravel-nova, laravel-nova-field
- Language: Vue
- Homepage:
- Size: 1.62 MB
- Stars: 41
- Watchers: 3
- Forks: 27
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Nova Table Field
[](https://packagist.org/packages/outl1ne/nova-table-field)
[](https://packagist.org/packages/outl1ne/nova-table-field)Simple [Laravel Nova](https://nova.laravel.com) Table field.
### Form View

## Installation
Install the package in a Laravel Nova project via Composer:
```bash
composer require outl1ne/nova-table-field
```## Usage
The `Table` field provides a convenient interface to edit rows and columns stored inside `JSON` equivalent column.
```php
use Outl1ne\NovaTableField\Table;public function fields(Request $request)
{
return [
Table::make('Countries')// Optional:
->disableAdding() // Disable adding new rows and columns
->disableDeleting() // Disable deleting rows and columns
->minRows(1) // The minimum number of rows in the table
->maxRows(10) // The maximum number of rows in the table
->minColumns(1) // The minimum number of columns in the table
->maxColumns(10) // The maximum number of columns in the table
->defaultValues([ // Default values for new rows
['column_1', 'column_2'], // This is a row
['column_3', 'column_4'], // This is a row
])
];
}
```Note that you also have to cast the `JSON` data to `array` in your model
```
protected $casts = ['countries' => 'array'];
```## Localization
The translations file can be published by using the following publish command:
```bash
php artisan vendor:publish --provider="Outl1ne\NovaTableField\FieldServiceProvider" --tag="translations"
```You can then edit the strings to your liking.