kavela / enhanced-image-uploader

Image fields for Nova apps

Stars
1

Image fields for Nova apps

This package contains a Nova field to add images to resources.

Requirements

This Nova field requires PHP 7.2 or higher.

Installation

You can install this package into a Laravel app that uses Nova via composer:

composer require kavela/enhanced-image-uploader
php artisan enhanced-image-uploader:install
php artisan migrate

Usage

To make an Eloquent model imageable follow next steps:

Update config/enhanced-image-uploader.php configuration file.

Next add the Kavela\EnhancedImageUploader\Traits\HasImages trait to it:

class Project extends Model
{
    use Kavela\EnhancedImageUploader\Traits\HasImages;
    
    ...
}

Next you can use the Kavela\EnhancedImageUploader\Images field in your Nova resource:

namespace App\Nova;

use Kavela\EnhancedImageUploader\Images;

class Project extends Resource
{
    // ...
    
    public function fields(Request $request)
    {
        return [
            // ...
            
            Images::make('Images'),

            // ...
        ];
    }
}

All images will be saved in the enhanced_image_uploader_images table.

Limiting images

You can limit the number of images with limit().

Images::make('Images')->limit($maxNumber),

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.