PHP code example of yurizoom / moonshine-media-manager
1. Go to this page and download the library: Download yurizoom/moonshine-media-manager 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/ */
yurizoom / moonshine-media-manager example snippets
use YuriZoom\MoonShineMediaManager\Components\MediaManagerOffCanvas;
final class MoonShineLayout extends AppLayout
{
protected function getContentComponents(): array
{
return [
...parent::getContentComponents(),
MediaManagerOffCanvas::make(),
];
}
}
use YuriZoom\MoonShineMediaManager\Pages\MediaManagerPage;
protected function menu(): array
{
return [
MenuItem::make(MediaManagerPage::class),
];
}
use YuriZoom\MoonShineMediaManager\Fields\MediaManagerPicker;
// Одно изображение
MediaManagerPicker::make('Изображение', 'image')
->allowedTypes(['image']),
// Множественный выбор с перетаскиванием
MediaManagerPicker::make('Галерея', 'images')
->multiple()
->allowedTypes(['image']),
// По типу (из менеджера): image, video, audio, pdf, word, code, zip, txt, ppt
->allowedTypes(['image'])
->allowedTypes(['image', 'pdf'])
// По расширению (точный контроль):
->allowedExtensions(['jpg', 'png', 'webp'])
->allowedExtensions(['pdf', 'doc', 'docx', 'xls', 'xlsx'])