ferdiunal / laravel-nova-media-field
用于Spatie媒体库的Laravel Nova媒体字段
v1.0.7
2024-09-16 18:53 UTC
Requires
- php: ^8.2
- laravel/framework: ^10.0|^11.0
- laravel/nova: ^4.0
- laravel/vapor-core: ^2.37
- spatie/laravel-medialibrary: ^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.16
- spatie/laravel-ray: ^1.36
README
Laravel Nova 媒体字段 是一个组件,旨在与Spatie的媒体库无缝集成,允许在Laravel Nova中高效管理媒体文件。此包使您可以直接从Nova仪表板上传、列出和编辑媒体文件变得简单。
功能
- 简单的媒体文件上传
- 预览和编辑
- 全面的媒体管理
此组件增强了Nova中的媒体管理体验,为开发人员提供了一种简单且可定制的解决方案。
安装
composer require ferdiunal/laravel-nova-media-field
用法
/** * Get the fields displayed by the resource. * * @return array */ public function fields(NovaRequest $request) { return [ ID::make()->sortable(), MediaField::make('Logo', 'logo') ->required() ->multiple() ->vapor() ->withResponsive() ->validate( minSize: 30, // The allowed extensions for the file. maxSize: 1024 * 50, // The allowed mime types for the file. size: 1024 * 50, // The minimum size of the file. image: false, // The maximum size of the file. video: false, // The size of the file. audio: false, // Whether to allow only image files. document: false, // Whether to allow only video files. pdf: false, // Whether to allow only audio files. txt: false, // Whether to allow only document files. json: false, // Whether to allow only PDF files. csv: false, // Whether to allow only text files. xlsx: false, // Whether to allow only JSON files. docx: false, // Whether to allow only CSV files. creation: false, // Whether to allow only XLSX files. update: false, // Whether to allow only DOCX files. default: false, // Whether to apply the rules for creation. allowedExtensions: [], // Whether to apply the rules for update. allowedMimeTypes: [] // Whether to apply the rules as default. ) ]; }