Laravel Nova package to toggle visibility of password field.
magdicom/nova-visible-password is a Laravel package for laravel nova package to toggle visibility of password field..
It currently has 3 GitHub stars and 36.504 downloads on Packagist (latest version v1.0.1).
Install it with composer require magdicom/nova-visible-password.
Discover more Laravel packages by magdicom
or browse all Laravel packages to compare alternatives.
Last updated


A Laravel Nova password field with a visibility toggle, its behaviour typical as the built-in password field, but with added features that you may find useful in certain use cases.
php: ^8laravel/nova: ^4You can install the package in to a Laravel app that uses Nova via composer:
composer require magdicom/nova-visible-password

Using the field is simple, just like any other Nova built-in field.
// in app/Nova/Resources/User.php
use Magdicom\NovaVisiblePassword\VisiblePassword;
class User extends Resource
{
public function fields(Request $request)
{
return [
VisiblePassword::make('Password')
];
}
}
The default behaviour of the password field is to encrypt the data when saving it using Laravel Hash class, to disable this functionality you simply need to call the hashOnSave method which accepts a boolean or callback:
VisiblePassword::make('Password')->hashOnSave(false),
Normally password fields would populate/displayed empty, but in some cases you may need these data to be present, use the withValue method which accepts a boolean or callback:
VisiblePassword::make('Password')->withValue(true),
You can disable the toggle button on create/update forms per field using visibleOnForms method:
VisiblePassword::make('Password')
->visibleOnForms(function(){
// your logic here
return false;
}),
visibleOnForms, visibleOnIndex and visibleOnDetail accepts boolean value or a callback.Optionally you can enable the toggle button on resource index page:
VisiblePassword::make('Password')->visibleOnIndex(),

Also you can enable the toggle button on resource detail page:
VisiblePassword::make('Password')->visibleOnDetail(),

The MIT License (MIT). Please see License File for more information.