Manage media library with a directory system and associate files with Eloquent models.
moirei/media-library is a Laravel package for manage media library with a directory system and associate files with eloquent models..
It currently has 0 GitHub stars and 505 downloads on Packagist (latest version 0.2.0).
Install it with composer require moirei/media-library.
Discover more Laravel packages by moirei
or browse all Laravel packages to compare alternatives.
Last updated
Laravel application media content management made easy.
All documentation is available at the documentation site.
...
use MOIREI\MediaLibrary\Casts\AsMediaItem;
use MOIREI\MediaLibrary\Casts\AsMediaItems;
use MOIREI\MediaLibrary\Traits\InteractsWithMedia;
class Product extends Model
{
use InteractsWithMedia;
$casts = [
'image' => AsMediaItem::class,
'gallery' => AsMediaItems::class,
];
...
}
...
$video = File::find('video-file-id');
$product = Product::create([
'name' => 'MOIREI MP202+',
'image' => 'image-file-id1',
'gallery' => ['image-file-id2', $video],
]);
composer require moirei/media-library
php artisan vendor:publish --tag=media-library-config
php artisan vendor:publish --tag=media-library-migrations
Then run the migrations
php artisan migrate
Please see CHANGELOG.
The MIT License (MIT). Please see License File for more information.