File Multiple Upload
How to declare a File Multiple Upload.
use Tassili\Crud\Fields\MultipleFile;
MultipleFile::make('files')
->label('New label') // optional
->notInDatabase() // optional, if you don't want this field in database
->fieldAndRecordNotNull() // optional, if you want to have at least one file in record or in field
->keepExistingFiles() // optional, if you want to keep existing files
->readOnly() // optional, if you want the field only readable when you update
->folder('posts/images') // optional, if you want to change the folder storage
->maxNumberFiles(3) // optional, if you want to limit the number of files
These files are returned in JSON format. If you’re saving them using Eloquent, you should be sure to add an array cast to the model property:
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'files' => 'array',
];
}
When you update, if you want to have at least one file in record or in field.
->fieldAndRecordNotNull()