Looking to hire Laravel developers? Try LaraJobs

laravel-backpack-dropzone-field maintained by raystechnology

Description
Add Dropzone support for Laravel Backpack
Author
Last update
2022/05/10 04:39 (dev-master)
License
Downloads
41

Comments
comments powered by Disqus

Backpack Dropzone field

Add Dropzone support for Laravel Backpack.

This package is a fork and upgrade of original package gaspertrix/laravel-backpack-dropzone-field.

Requirements

Limitations

Currently, you can only manage media while editing an entry.

Install

Via Composer

composer require raystechnology/laravel-backpack-dropzone-field:^4.0.0

The package will automatically register itself.

You must publish public assets:

php artisan rays:backpack:dropzone:install

You may publish views with:

php artisan vendor:publish --provider="Rays\LaravelBackpackDropzoneField\DropzoneFieldServiceProvider" --tag="views"

Usage

EntityCrudController

For simplicity add the MediaOperation operation to EntityCrudController.

<?php

...


class EntityCrudController extends CrudController
{
	...
    use \Rays\LaravelBackpackDropzoneField\App\Http\Controllers\Operations\MediaOperation;

	...
}

Field

[
	...
	'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,
		],
	]);
});

...

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email github-security@r4ys.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.