ardenthq / nova-enhanced-textarea
Custom textarea field with character count
Installs: 4 802
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: ^9.30
- laravel/nova: ^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.10
- orchestra/testbench: ^7.7
- pestphp/pest: ^1.21
- phpstan/phpstan: ^1.8
- rector/rector: ^0.14
README
A custom Textarea Field for Nova with character count
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
-
Add the
EnhancedTextarea
field to your Nova Resource. -
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
- Run
yarn nova:install
andyarn install
to install all the necessary dependencies for compiling the view components. - Run
yarn run dev
(oryarn run watch
) while making changes to the components in your local environment. - If you change the vue components, ensure to compile for production before making a PR.
Compile for production
- Run
yarn nova:install
andyarn install
to install all the necessary dependencies for compiling the view components. - 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 security@ardenthq.com. All security vulnerabilities will be promptly addressed.
Credits
This project exists thanks to all the people who contribute.