PHP code example of anish / clearfield-action

1. Go to this page and download the library: Download anish/clearfield-action library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anish / clearfield-action example snippets




namespace App\Filament\Resources\Users\Pages;

use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Users\UserResource;
use Anish\ClearFieldAction\Actions\ClearFieldAction;

class CreateUser extends CreateRecord
{
    protected static string $resource = UserResource::class;

    protected function getHeaderActions(): array
    {
        return [
            ClearFieldAction::make(),
        ];
    }
}

ClearFieldAction::make()
    -> Form Fields?')
    ->confirmationDescription('Are you sure you want to clear all form fields?')

ClearFieldAction::make()
    ->notificationTitle('Fields Cleared')
    ->notificationBody('All form fields have been reset successfully.')

ClearFieldAction::make()
    ->beforeReset(function ($livewire) {
        // Execute before clearing fields
        Log::info('Clearing form fields');
    })
    ->afterReset(function ($livewire) {
        // Execute after clearing fields
        Log::info('Form fields cleared');
    })

ClearFieldAction::make()
    ->showNotification(false)

ClearFieldAction::make()
    ->icon('heroicon-o-x-mark')
    ->color('danger')
    ->label('Clear All')
bash
php artisan vendor:publish --tag=clearfield-action-config