PHP code example of jameslkingsley / nova-media-library-field
1. Go to this page and download the library: Download jameslkingsley/nova-media-library-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/ */
jameslkingsley / nova-media-library-field example snippets
use Kingsley\NovaMediaLibrary\Fields\Image;
Image::make('Avatar', 'avatar')
->usingConversion('thumb')
->preservingOriginal()
use Kingsley\NovaMediaLibrary\Fields\File;
File::make('Invoice', 'invoice')
public function registerMediaCollections()
{
$this
->addMediaCollection('invoice')
->singleFile()
->acceptsFile(function (File $file) {
return $file->mimeType === 'application/pdf';
});
}
use Kingsley\NovaMediaLibrary\Fields\Images;
public function fields(Request $request)
{
return [
...
Images::make(),
];
}
Nova::resources([
\Kingsley\NovaMediaLibrary\Resources\Media::class
]);