yajra / laravel-datatables-editor

Laravel DataTables Editor Integration.
https://yajrabox.com/docs/laravel-datatables/editor-installation
MIT License
115 stars 14 forks source link

Add support for handling field type upload and uploadMany. #38

Closed yajra closed 5 years ago

yajra commented 5 years ago
markplus commented 8 months ago

I didn't quite understand how to use this function, now I have to add two uploads, one for PDFs and one for images, even if I see the upload form when I try to upload it gives me this error "A server error occurred while uploading the file"

    public function createRules(): array
    {
        return [
            'categoria' => 'required',
            'title' => 'required',
            'description' => 'required',
            'file' =>'required|mimes:pdf,xlx,xlsx,xls,csv,txt|max:10048',
            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048'
        ];
    }
        ->editors([
            Editor::make()
            ->fields([
                Fields\Text::make('categoria')->label('Fornitore'),
                Fields\Text::make('title')->label('Nome'),
                Fields\Text::make('description')->label('Anno'),
                Fields\File::make('file_path')->label('Listino')->type('upload'),
                Fields\Image::make('image_path')->label('Formato')->type('upload'),
            ]),
        ])

Where am I doing wrong?