PHP code example of nova-kit / nova-field-mixins

1. Go to this page and download the library: Download nova-kit/nova-field-mixins 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/ */

    

nova-kit / nova-field-mixins example snippets


use Laravel\Nova\Fields\DateTime;

DateTime::make('Created At')->sortable()->displayUsing(fn ($d) => $d?->diffForHumans()),
DateTime::make('Updated At')->sortable()->displayUsing(fn ($d) => $d?->diffForHumans()),

 

namespace App\Nova\Fields\Mixins;

use Laravel\Nova\Fields\Field;

class StandardDateTime
{
    public function __invoke(Field $field)
    {
        $field->sortable()->displayUsing(fn ($d) => $d?->diffForHumans());
    }
}

use App\Nova\Fields\Mixins\StandardDateTime;
use Laravel\Nova\Fields\DateTime;

DateTime::make('Created At')->apply(StandardDateTime::class),
DateTime::make('Updated At')->apply(StandardDateTime::class),

use Laravel\Nova\Fields\Text;
use NovaKit\Fields\Mixins\AsArrayObject;

Text::make('Name', 'profile.name')->apply(new AsArrayObject()),

use Laravel\Nova\Fields\Text;

Text::make('Name', 'profile.name')->fromArrayObject(),