PHP code example of energon7 / nova-items-field

1. Go to this page and download the library: Download energon7/nova-items-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

energon7 / nova-items-field example snippets


use NovaItemsField\Items;

function fields() {
    return [
        Items::make('Emails'),
    ]
}

public $casts = [
    'emails' => 'array'
];

Items::make('Emails')->rules([
    'emails.*' => 'email|min:10',
]),

Items::make('Long Text', 'attribute')->rules([
    'attribute.*' => 'email|min:10',
]),

function saving($user)
{
    foreach($user->emails as $email)
    {
        //
    }
}