承接 visual-ideas/moonshine-spatie-medialibrary 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

visual-ideas/moonshine-spatie-medialibrary

最新稳定版本:4.0.3

Composer 安装命令:

composer require visual-ideas/moonshine-spatie-medialibrary

包简介

Spatie\MediaLibrary field for MoonShine Laravel admin panel

README 文档

README

Latest Version on Packagist Total Downloads

Compatibility

MoonShine Moonshine Spatie Medialibrary Currently supported
>= v1.52 and < v2.0 <= v1.2.0 no
>= v2.0 >= v2.0.1 yes
>= v3.0 >= v3.0.0 yes
>= v4.0 >= v4.0.0 yes

Installation

The field is purposed for work with the Laravel-MediaLibrary package made by Spatie and extends default field Image

composer require visual-ideas/moonshine-spatie-medialibrary

Before using the Spatie\MediaLibrary field, make sure that:

  • The spatie/laravel-medialibrary package is installed and configured
  • The visual-ideas/moonshine-spatie-medialibrary package is installed
  • The field passed to Spatie\MediaLibrary is added as the name of the collection via ->addMediaCollection('Field')

In the model:

use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
 
class ModelClass extends Model implements HasMedia
{
    use InteractsWithMedia;
 
    //...
    
    public function registerMediaCollections(): void
    {
        $this->addMediaCollection('cover');
    }
    
    //...
}

In the MoonShine:

use VI\MoonShineSpatieMediaLibrary\Fields\MediaLibrary;

//...

MediaLibrary::make('Cover', 'cover'),

//...

By default, the field works in a single image mode

use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
 
class ModelClass extends Model implements HasMedia
{
    use InteractsWithMedia;
    
    //...
    
    public function registerMediaCollections(): void
    {
        $this->addMediaCollection('cover')->singleFile();
    }
    
    //...
}

If you want to use a field to load multiple images, add the ->multiple() method when declaring the field

use VI\MoonShineSpatieMediaLibrary\Fields\MediaLibrary;

//...

MediaLibrary::make('Gallery', 'gallery')->multiple(),

//...

统计信息

  • 总下载量: 11.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-08