PHP code example of julienmru / laravel-backpack-dropzone-field
1. Go to this page and download the library: Download julienmru/laravel-backpack-dropzone-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
julienmru / laravel-backpack-dropzone-field example snippets
...
use JulienMru\BackpackDropzoneField\Traits\HandleAjaxMedia;
...
class EntityCrudController extends CrudController
{
...
use HandleAjaxMedia;
...
}
...
Route::crud('entity', 'EntityCrudController')
Route::post('entity/{id}/media', 'EntityCrudController@uploadMedia');
Route::delete('entity/{id}/media/{mediaId}', 'EntityCrudController@deleteMedia');
Route::post('entity/{id}/media/reorder', 'EntityCrudController@reorderMedia');
...
bash
php artisan julienmru:backpackdropzonefield:install
...
$this->crud->operation(['update'], function() {
$this->crud->addField([
'label' => 'Photos',
'type' => 'dropzone_media',
'name' => 'photos',
'collection' => 'photos',
'thumb_collection' => 'thumbs',
'options' => [
'thumbnailHeight' => 120,
'thumbnailWidth' => 120,
'maxFilesize' => 10,
'addRemoveLinks' => true,
'createImageThumbnails' => true,
],
]);
});
...