PHP code example of maggomann / filament-only-icon-display

1. Go to this page and download the library: Download maggomann/filament-only-icon-display 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/ */

    

maggomann / filament-only-icon-display example snippets



use Filament\Resources\RelationManagers\RelationManager;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Actions\CreateAction;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Actions\DeleteAction;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Actions\EditAction;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Actions\ViewAction;

class YourRelationManager extends RelationManager
{
    public static function table(Table $table): Table
    {
        return $table
            ->actions([
                CreateAction::make()->onlyIconAndTooltip(), // show icon and tooltip with the content of $this->name
                EditAction::make()->onlyIconAndTooltip(), // show icon and tooltip with the content of $this->name
                ViewAction::make()->onlyIconAndTooltip(), // show icon and tooltip with the content of $this->name
                DeleteAction::make()->onlyIconAndTooltip(), // show icon and tooltip with the content of $this->name
            ])
        //....

    }
}


use Filament\Tables\Actions\Action;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Traits\HasOnlyIcon;

class YourOwnAction extends Action
{
    use HasOnlyIcon;
}

// ...
// ...
// ...

use Filament\Resources\RelationManagers\RelationManager;
use YourOwnAction;

class YourRelationManager extends RelationManager
{
    public static function table(Table $table): Table
    {
        return $table
            ->actions([
                YourOwnAction::make('you need a name')->onlyIconAndTooltip(),
            ])
        //....

    }
}



use Filament\Tables\Actions\Action;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Traits\HasOnlyIcon;

class YourOwnAction extends Action
{
    use HasOnlyIcon;
}

YourOwnAction::make('my name')->onlyIconAndTooltip(), // tooltip content: my name
YourOwnAction::make('my name')
    ->label('my label')
    ->onlyIconAndTooltip(), // tooltip content: my label
YourOwnAction::make('my name')
    ->label('my label')
    ->tooltip('my tooltip')
    ->onlyIconAndTooltip(), // tooltip content: my tooltip



use Filament\Tables\Actions\Action;
use Maggomann\FilamentOnlyIconDisplay\Domain\Tables\Traits\HasOnlyIcon;

class YourOwnAction extends Action
{
    use HasOnlyIcon;
}

YourOwnAction::make('my name')->onlyIcon(), // tooltip content: no content
YourOwnAction::make('my name')
    ->label('my label')
    ->onlyIcon(), // tooltip content: no content
YourOwnAction::make('my name')
    ->label('my label')
    ->tooltip('my tooltip')
    ->onlyIcon(), // tooltip content: no content