PHP code example of unexpectedjourney / filament-toolbox
1. Go to this page and download the library: Download unexpectedjourney/filament-toolbox 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/ */
unexpectedjourney / filament-toolbox example snippets
use UnexpectedJourney\FilamentToolbox\Tables\Columns\HeadingDetailColumn;
HeadingDetailColumn::make('sku')
->detail(fn(Product $record): string => $record->name)
use UnexpectedJourney\FilamentToolbox\Tables\Columns\HeadingDetailColumn;
HeadingDetailColumn::make('sku')
->heading(fn(Product $record): string => str($record->sku)->upper())
->detail(fn(Product $record): string => $record->name)
HeadingDetailColumn::make('sku')
->detail(fn(Product $record): string => $record->name)
->limit(30)
HeadingDetailColumn::make('sku')
->detail(fn(Product $record): string => $record->name)
->limitHeading(100)
->limitDetail(30)
HeadingDetailColumn::make('sku')
->detail(fn(Product $record): string => $record->name)
->showTooltipsWhenLimited(false)
->limitDetail(30)
use UnexpectedJourney\FilamentToolbox\Tables\Columns\FlagColumn;
use UnexpectedJourney\FilamentToolbox\Tables\Columns\FlagColumn\Flag;
FLagColumn::make('flags')
->flags([
Flag::make('trashed', 'heroicon-o-trash'),
Flag::make('on_sale', 'heroicon-o-tag'),
Flag::make('bundle', 'heroicon-o-archive-box')
])
FLagColumn::make('flags')
->flags([
Flag::make('trashed', 'heroicon-o-trash'),
Flag::make('on_sale', 'heroicon-o-tag'),
Flag::make('bundle', 'heroicon-o-archive-box'),
Flag::make('visible')
->icon(fn(bool $active): string => $active
? 'heroicon-o-eye'
: 'heroicon-o-eye-slash')
])
FLagColumn::make('flags')
->showInactive()
->flags([
Flag::make('trashed', 'heroicon-o-trash'),
Flag::make('on_sale', 'heroicon-o-tag'),
Flag::make('bundle', 'heroicon-o-archive-box')
])
FLagColumn::make('flags')
->flags([
Flag::make('trashed', 'heroicon-o-trash')
->showWhenInactive(),
Flag::make('on_sale', 'heroicon-o-tag'),
Flag::make('bundle', 'heroicon-o-archive-box')
])
use Filament\Support\Colors\Color;
FLagColumn::make('flags')
->activeColor('success')
->inactiveColor(Color::Stone)
->flags([
Flag::make('trashed', 'heroicon-o-trash')
->activeColor('danger'),
Flag::make('on_sale', 'heroicon-o-tag'),
Flag::make('bundle', 'heroicon-o-archive-box')
])
FLagColumn::make('flags')
->activeIcon('heroicon-o-check')
->inactiveIcon('heroicon-o-x-mark')
->flags([...])
FLagColumn::make('flags')
->showTooltips()
->flags([...])
FLagColumn::make('flags')
->showTooltips()
->flags([
Flag::make('published', 'heroicon-o-calendar')
->tootip(fn(bool $active, Model $record): string => $active
? 'Published on '.$record->published_at
: 'Not published')
])
FLagColumn::make('flags')
->showTooltips()
->flags([
Flag::make('published', 'heroicon-o-calendar')
->url(fn(bool $active, Model $record): ?string => $active
? $record->getUrl()
: null)
])
FLagColumn::make('flags')
->showTooltips()
->flags([
Flag::make('published', 'heroicon-o-calendar')
->url(...)
->openUrlInNewTab()
])