stepanenko3 / nova-media-field
A Laravel Nova field for laravel-medilibrary.
Installs: 3 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 6
Open Issues: 11
Language:Vue
Requires
- php: ^8.2
- laravel/nova: ^4.22
- spatie/laravel-medialibrary: ^11.4
- stepanenko3/nova-filemanager: ^7.1.1
Requires (Dev)
- phpstan/phpstan: ^1.10
- tightenco/duster: ^2.7
- dev-main
- v3.0.1
- v3.0.0
- v2.0.0
- v1.0.9
- v1.0.8
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.0
- dev-dependabot/npm_and_yarn/vite-5.3.5
- dev-dependabot/npm_and_yarn/vue/compiler-sfc-3.4.34
- dev-dependabot/npm_and_yarn/vue-3.4.34
- dev-dependabot/npm_and_yarn/sass-1.77.8
- dev-dependabot/npm_and_yarn/vueuse/core-10.11.0
- dev-dependabot/composer/tightenco/duster-tw-3.0
- dev-mobile-updates
- dev-big-update
This package is auto-updated.
Last update: 2024-10-26 00:41:49 UTC
README
Description
A Laravel Nova field for laravel-medilibrary.
Features
- Multiple / Single image support
- Multiple images auto-detect based on collection
- Display validation errors
- Show on index multiple images
- Modal with media details
- Show all conversions
- Open / Download / Copy URL of media
- Regenerate image with conversions
- Custom properties support
Requirements
php: >=8.0
laravel/nova: ^4.0
spatie/laravel-medilibrary
: ^11.4
Installation
# Install the package
composer require stepanenko3/nova-media-field
Usage
use use Stepanenko3\NovaMediaField\Fields\Media; ... Media::make(__('Image'), 'image'), // Single image. Auto detect from collection Media::make(__('Images'), 'images'), // Multiple images. Auto detect from collection // Validation rules Media::make('Images', 'images') ->rules(['required', 'array', 'max:4']) ->singleMediaRules(['image', 'max:80']), // Custom properties with validtion Media::make('Images', 'images') ->customPropertiesFields([ Boolean::make('Active', 'active') ->rules(['boolean']), Markdown::make('Description', 'description') ->rules(['max:1000']), ]) // Count images displayed on index Media::make('Images', 'images') ->countOfImagesDisplayedOnIndex(2), // Full example Media::make('Images', 'images') ->customPropertiesFields([ Boolean::make('Active', 'active') ->rules(['boolean']), Markdown::make('Description', 'description') ->rules(['max:1000']), ]) ->countOfImagesDisplayedOnIndex(2) ->rules(['required', 'array', 'max:4']) ->singleMediaRules(['image', 'max:80']),
Usage with File Manager
Install stepanenko3/nova-filemanager
compore require stepanenko3/nova-filemanager
Register Service provider
// app/Providers/NovaServiceProvider.php public function tools(): array { return [ new Stepanenko3\NovaFileManager\FileManagerTool, ]; }
Use Media field with File Manager
Media::make(__('Image'), 'image') ->fileManager(),
Screenshots
Credits
Contributing
Thank you for considering contributing to this package! Please create a pull request with your contributions with detailed explanation of the changes you are proposing.
License
This package is open-sourced software licensed under the MIT license.