ardenthq/nova-enhanced-textarea

Custom textarea field with character count

Downloads

4792

Stars

1

Version

1.0.2

This package has been archived

Laravel Nova Enhanced Textarea Field

A custom Textarea Field for Nova with character count

Stable Version License PHP Version Require

Note this feature has been added to Nova's own TextArea component starting with Nova 4.16.0. Please make use of the built-in feature over this package.

Features

  • For Laravel Nova ^4.0
  • Character count and maxLength warning

Installation

composer require ardenthq/nova-enhanced-textarea

Use

  1. Add the EnhancedTextarea field to your Nova Resource.

  2. Call the ->maxLength() method to define the max number of characters that the field should show.

<?php
namespace App\Nova;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Resource;
use Ardenthq\EnhancedTextarea\EnhancedTextarea;

final class ResourceName extends Resource
{
    // ....
    public function fields(NovaRequest $request)
    {
        return [
            // ....
            EnhancedTextarea::make('Description', 'description')
                ->rules('nullable', 'string', 'max:1000')
                ->hideFromIndex()
                ->maxLength(1000),
                // ...
        ];
    }
    // ...
}

Development

  1. Run yarn nova:install and yarn install to install all the necessary dependencies for compiling the view components.
  2. Run yarn run dev (or yarn run watch) while making changes to the components in your local environment.
  3. If you change the vue components, ensure to compile for production before making a PR.

Compile for production

  1. Run yarn nova:install and yarn install to install all the necessary dependencies for compiling the view components.
  2. Run yarn run production.

Analyze the code with phpstan

composer analyse

Refactor the code with php rector

composer refactor

Format the code with php-cs-fixer

composer format

Run tests

composer test

Security

If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.

Credits

This project exists thanks to all the people who contribute.

License

MIT © Ardent

ArdentHQ

Author

ArdentHQ