1. Go to this page and download the library: Download outl1ne/nova-media-hub 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/ */
outl1ne / nova-media-hub example snippets
// in app/Providers/NovaServiceProvider.php
public function tools()
{
return [
// ...
\Outl1ne\NovaMediaHub\MediaHub::make()
// You can choose to hide the Tool from the sidebar
->hideFromMenu()
// Optionally add additional fields to Media items
->withCustomFields(
['copyright' => __('Copyright')],
overwrite: false
)
];
}
use Outl1ne\NovaMediaHub\Nova\Fields\MediaHubField;
// ...
MediaHubField::make('Media', 'media')
->defaultCollection('products') // Define the default collection the "Choose media" modal shows
->multiple(), // Define whether multiple media can be selected
class Product extends Model
{
protected $casts = [
'media' => \Outl1ne\NovaMediaHub\Casts\MediaCast::class,
];
}