Dropzone Last updated: 2022-10-04

This function built based on Dropzone JS

You can use the drop zone with all the resources quite easily, you will not need a lot of settings, all you have to do is

dropzone()->make('Upload Files', 'dropzone') 
// (dropzone) this for id not using a columns in current model
	          ->autoQueue(true)//true|false
	          ->maxFileSize(1000)//mb
	          ->maxFiles(30)// files
	          ->parallelUploads(20)//files
	          ->thumbnailWidth(80)//px
	          ->thumbnailHeight(80)//px
	          ->acceptedMimeTypes('video/*', 'image/*'),
	          or 
	          ->acceptedMimeTypes(['video/*', 'image/*']),

 

How are files stored in the DropZone?

you have a migration file 

2021_02_18_102130_create_filemanager_table.php

and Model from dash project Dash\Models\FileManagerModel 

The reference to the resource is stored by morphTo

With the same resource model

example with column 

file_type & file_id 

If you can create a method to fetch files

example with Article Model


class Article extends Model {
	use HasFactory;
	
	
 public function files() {
	return $this->morphMany(\Dash\Models\FileManagerModel::class , 'file');
 }

}

This can be applied to any model in the future

Do not forget that the drop zone is supported in both Arabic and English by default, but the main use is the English language according to the basic settings of the configuration file