Laravel Nova Profile Resource Tools provide the 3 resource tools (Resource Tools)
-
NovaProfileInformationTools
Provide a input fields and the default controller method to update thename
andemail
fields in theusers
table.
-
NovaDeleteAccountTools
Provide the functionality to delete the user account by confirming existing current password.
composer require monaye/nova-profile-resource-tools
This package rely on the full Tailwind and recommend using the optimistdigital/nova-tailwind
.
composer require optimistdigital/nova-tailwind
use Monaye\NovaProfileResourceTools\NovaPasswordTools;
use Monaye\NovaProfileResourceTools\NovaDeleteAccountTools;
use Monaye\NovaProfileResourceTools\NovaProfileInformationTools;
public function fields(Request $request)
{
return [
NovaProfileInformationTools::make('Update Profile')
->name_user($request->user()->name)
->email($request->user()->email),
NovaPasswordTools::make('Change Password'),
NovaDeleteAccountTools::make('Delete Account'),
];
}
This package come with a default controller and methods to handle all 3 APIs call from the components. You could overwrite the controller@method to handle the API call instead of the default one.
To user your own controller@method, first publish the config file
php artisan vendor:publish --tag=nova-profile-resource-tools
Open the config file config/nova-profile-resource-tools.php
and update.
<?php
use Monaye\NovaProfileResourceTools\Controllers\NovaProfileResourceToolsController;
return [
'handleInformationUpdate' => [NovaProfileResourceToolsController::class, 'updateInformation'],
'handlePasswordUpdate' => [NovaProfileResourceToolsController::class, 'updatePassword'],
'handleDeleteAccount' => [NovaProfileResourceToolsController::class, 'deleteAccount'],
];
Hope you find it useful. Feel free to reach out with feedback.
Follow me on twitter: @winmonaye