1. Go to this page and download the library: Download mark7651/filament-mediator 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 Mediator\Filament\Forms\MediaField;
MediaField::make('cover_id'),
MediaField::make('icon_id')->takes(['image/svg+xml', 'image/png']),
MediaField::make('gallery')->multiple(),
use Filament\Forms\Components\RichEditor;
use Mediator\Filament\Forms\MediaImagePlugin;
RichEditor::make('body')
->plugins([MediaImagePlugin::make()])
->toolbarButtons([['bold', 'italic'], ['image']]),
use Mediator\Models\Media;
use Mediator\Uses\Places;
app(Places::class)
->standsIn(Article::class, 'cover_id', withTrashed: true)
->standsIn(Practice::class, 'icon_id')
->counted(fn (Media $file): int => Page::standingInBlocks((int) $file->getKey()));
namespace App\Models;
use Mediator\Models\Media as LibraryMedia;
class Media extends LibraryMedia
{
// relations, casts, whatever the project needs of it
}
use Illuminate\Database\Eloquent\Builder;
use Mediator\Mediator;
Mediator::scope(fn (Builder $files) => $files->whereBelongsTo(Filament::getTenant()));