Add Dropzone support for Laravel Backpack
gaspertrix/laravel-backpack-dropzone-field is a Laravel package for add dropzone support for laravel backpack.
It currently has 17 GitHub stars and 2.458 downloads on Packagist (latest version 3.0.1).
Install it with composer require gaspertrix/laravel-backpack-dropzone-field.
Discover more Laravel packages by gaspertrix
or browse all Laravel packages to compare alternatives.
Last updated
Add Dropzone support for Laravel Backpack.
Currently, you can only manage media while editing an entry.
composer require gaspertrix/laravel-backpack-dropzone-field:^3.0.0
The package will automatically register itself.
You must publish public assets:
php artisan gaspertrix:backpack:dropzone:install
You may publish views with:
php artisan vendor:publish --provider="Gaspertrix\LaravelBackpackDropzoneField\DropzoneFieldServiceProvider" --tag="views"
For simplicity add the MediaOperation operation to EntityCrudController.
<?php
...
class EntityCrudController extends CrudController
{
...
use \Gaspertrix\LaravelBackpackDropzoneField\App\Http\Controllers\Operations\MediaOperation;
...
}
[
...
'type' => 'dropzone_media',
'view_namespace' => 'dropzone::fields',
'collection' => 'photos', // Media collection where files are added to
'thumb_collection' => 'thumbs', // Media collection where thumb are displayed from. If not set, 'collection' is used by default
'options' => [
... // Dropzone options
]
...
]
Example:
<?php
...
$this->crud->operation(['update'], function() {
$this->crud->addField([
'label' => 'Photos',
'type' => 'dropzone_media',
'view_namespace' => 'dropzone::fields',
'name' => 'photos',
'collection' => 'photos',
'thumb_collection' => 'thumbs',
'options' => [
'thumbnailHeight' => 120,
'thumbnailWidth' => 120,
'maxFilesize' => 10,
'addRemoveLinks' => true,
'createImageThumbnails' => true,
],
]);
});
...
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.