daniel-de-wit/nova-paperclip

Laravel Nova fields for laravel-paperclip attachments.

2.2.0 2023-03-06 09:42 UTC

This package is auto-updated.

Last update: 2024-10-06 12:51:54 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.