PHP code example of arielmejiadev / filament-printable

1. Go to this page and download the library: Download arielmejiadev/filament-printable 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/ */

    

arielmejiadev / filament-printable example snippets


// Add print button in a filament list header

class ListUsers extends ListRecords
{
    protected function getHeaderActions(): array
    {
        return [
            // ...
            PrintAction::make(),
        ];
    }
}


// Add print button in Filament CreateRecord or EditRecord class

class EditUser extends EditRecord
{
    protected function getHeaderActions(): array
    {
        return [
            // ...
            \ArielMejiaDev\FilamentPrintable\Actions\PrintAction::make(),
        ];
    }
} 


// Add print button as a bulk action

->bulkActions([
    Tables\Actions\BulkActionGroup::make([
        Tables\Actions\DeleteBulkAction::make(),
        \ArielMejiaDev\FilamentPrintable\Actions\PrintBulkAction::make(),
    ]),
]);


    public static function form(Form $form): Form
    {
        return $form
            ->schema([

                Forms\Components\Grid::make()->schema([
                    Forms\Components\TextInput::make('name'),
                    Forms\Components\TextInput::make('email'),
                ])->columns([
                        'xs' => 1,
                        'sm' => 2,
                    ]),

                Forms\Components\Section::make([
                    Forms\Components\TextInput::make('name'),
                    Forms\Components\TextInput::make('email'),
                    Forms\Components\TextInput::make('second_email'),
                ])->columns([
                        'xs' => 1,
                        'sm' => 3,
                    ]),
            ]);
    }
bash
php artisan filament-printable:install

// or

php artisan vendor:publish --tag="filament-printable-stubs"