PHP code example of stepanenko3 / nova-media-field
1. Go to this page and download the library: Download stepanenko3/nova-media-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/ */
stepanenko3 / nova-media-field example snippets
use use Stepanenko3\NovaMediaField\Fields\Media;
...
Media::make(__('Image'), 'image'), // Single image. Auto detect from collection
Media::make(__('Images'), 'images'), // Multiple images. Auto detect from collection
// Validation rules
Media::make('Images', 'images')
->rules([' ->rules(['max:1000']),
])
// Count images displayed on index
Media::make('Images', 'images')
->countOfImagesDisplayedOnIndex(2),
// Full example
Media::make('Images', 'images')
->customPropertiesFields([
Boolean::make('Active', 'active')
->rules(['boolean']),
Markdown::make('Description', 'description')
->rules(['max:1000']),
])
->countOfImagesDisplayedOnIndex(2)
->rules(['
// app/Providers/NovaServiceProvider.php
public function tools(): array
{
return [
new Stepanenko3\NovaFileManager\FileManagerTool,
];
}