1. Go to this page and download the library: Download voodflow/vmedia 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/ */
use Voodflow\Vmedia\Concerns\HasAttachedMedia;
class Booth extends Model
{
use HasAttachedMedia;
}
use Voodflow\Vmedia\Filament\Forms\Components\VmediaFileUpload;
VmediaFileUpload::make('logo')
->collection('logo')
->image();
use Voodflow\Vmedia\Filament\Forms\Components\VmediaPicker;
VmediaPicker::make('gallery')
->collection('gallery')
->images()
->multiple();
use Voodflow\Vmedia\Support\Integration\RegistersPluginVault;
public function boot(): void
{
if (! class_exists(RegistersPluginVault::class)) {
return;
}
// source = stable id (integration_source), slug = folder slug in the UI
RegistersPluginVault::register(
source: 'acme',
slug: 'acme',
name: 'Acme', // or fn (): string => __('acme::nav.media_root')
// integrationKey: 'root:acme', // optional; default root:{slug}
);
RegistersPluginVault::ensureOnBoot($this->app, 'acme');
}
use Voodflow\Vmedia\Vmedia;
Vmedia::registerPluginVault('acme', 'acme', 'Acme');
Vmedia::ensurePluginVault('acme'); // or RegistersPluginVault::ensureOnBoot(...)
use Voodflow\Vmedia\Support\Integration\PluginVaultRootGroup;
use Voodflow\Vmedia\Support\Integration\PluginVaultLibraryGallery;
use Voodflow\Vmedia\Support\MediaLibrary;
use Voodflow\Vmedia\Filament\Forms\Components\VmediaPicker;
// Top-level folder (KIND_GROUP)
$root = PluginVaultRootGroup::for('acme');
// Default Library album under that folder (KIND_ALBUM) — prefer this for uploads
$library = PluginVaultLibraryGallery::album('acme');
MediaLibrary::store($uploadedFile, $library);
// Lock a Filament picker to your plugin library
VmediaPicker::make('hero')
->images()
->attachToRecord(false)
->vaultGallery(fn (): int => (int) PluginVaultLibraryGallery::album('acme')->getKey());