awesome-nova/features

Some features for laravel Nova

v1.1.0 2019-08-28 18:34 UTC

This package is auto-updated.

Last update: 2024-10-29 06:05:35 UTC


README

Latest Version on Github Total Downloads Become a Patron!

  1. Installation
  2. Usage

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require awesome-nova/features

Usage

Component replacement

You need to create specified components for resource and specify replacement:

class MyResource extends Resource {
    public static function additionalInformation(Request $request)
    {
        return [
            'components' => [
                'detail-header' => 'my-resource-detail-header',
                'detail-toolbar' => 'my-resource-detail-toolbar',
                'index-header' => 'my-resource-index-header',
                'index-toolbar' => 'my-resource-index-toolbar',
            ],
        ];
    }
}

This does not work if you replaced custom-(detail|index)-(header|toolbar) components.

Keep original file name

If you need to keep original file name in File field you can use keepOriginalName method:

public function fields(Request $request) {
    return [
        File::make('Upload')->keepOriginalName()
    ];
}

Also it works on Image and Avatar fields.