mikebronner / nova-file-upload-field

The easiest drag-and-drop file uploading field for Laravel Nova.
MIT License
53 stars 7 forks source link

Add documentation, video, screenshots, etc. #6

Closed mikebronner closed 4 years ago

kirschbaum commented 4 years ago

Would love to try this package. Would be great to know how to install and get it set up.

mikebronner commented 4 years ago

Sorry about the lack of documentation. Will work on that. In the mean while:

  1. composer require genealabs\nova-file-upload-field.
  2. Add it as a field in your Nova resource:
    
    <?php namespace App\Nova;

use GeneaLabs\NovaFileUploadField\FileUpload; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Text; use Laravel\Nova\Fields\Textarea;

class Image extends Resource { public static $model = 'App\Image'; public static $title = 'title'; public static $search = [ "id", "description", "title", ];

public function fields(Request $request)
{
    return [
        ID::make()
            ->sortable(),
        Text::make("Title", "title")
            ->sortable()
            ->rules("required", "max:255"),
        FileUpload::make("Image", "path")
            ->thumbnail(function ($image) {
                return $image
                    ? asset($image)
                    : '';
            })
            ->disk("tenant")
            ->path("media")
            ->prunable(),
        Textarea::make("Description"),
    ];
}

}

kirschbaum commented 4 years ago

Sweet, thank you @mikebronner!

mikebronner commented 4 years ago

@kirschbaum NP :) please let me know if you encounter any issues, or have ideas for improvements. :)

Dontorpedo commented 4 years ago

typo in

composer require genealabs\nova-file-upload-field

this worked

composer require generalabs/nova-file-upload-field