monaye/nova-profile-resource-tools

A Laravel Nova resource tool.

Downloads

107

Stars

1

Version

Nova Profile Resource Tools

Laravel Nova Profile Resource Tools provide the 3 resource tools (Resource Tools)

  1. NovaProfileInformationTools
    Provide a input fields and the default controller method to update the name and email fields in the users table.
    profile-field

  2. NovaPasswordTools
    Allow user to update the password. profile-password

  3. NovaDeleteAccountTools
    Provide the functionality to delete the user account by confirming existing current password. profile-delete-account

Installation

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

Usage

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'),
    ];
}

Configuring Controller

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

Screenshots

profile-field-duplicate-validation profile-filed-name-validation profile-field profile-password-confirm-current profile-password-validation profile-password profile-delete-validate-password profile-delete-confirm profile-delete-account

monaye

Author

monaye