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/ */
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(),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.