daniel-de-wit/nova-paperclip

Laravel Nova fields for laravel-paperclip attachments.

1.0.1 2021-07-13 07:13 UTC

This package is auto-updated.

Last update: 2021-11-13 08:25:37 UTC


README

Laravel Nova fields for laravel-paperclip attachments.

Screenshot

Installation

composer require daniel-de-wit/nova-paperclip

Fields

  • PaperclipFile
  • PaperclipImage

Usage

Add to Nova resource

<?php

namespace App\Nova;

use DanielDeWit\NovaPaperclip\PaperclipImage;


class MyResource extends Resource
{
    public function fields(Request $request): array
    {
        return [
            PaperclipImage::make('My Paperclip Image', 'image')
                ->mimes(['png'])
                ->width(1080)
                ->height(1080)
                ->rules(
                    'required',
                    'mimetypes:image/png',
                    'mimes:png',
                    'dimensions:width=1080,height=1080'
                ),
        ];
    }
}

The extra methods such as width() and height() are currently only used for display. Rules should still be set manually.