PHP code example of arseno25 / filament-privacy-blur
1. Go to this page and download the library: Download arseno25/filament-privacy-blur 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/ */
arseno25 / filament-privacy-blur example snippets
use Arseno25\FilamentPrivacyBlur\FilamentPrivacyBlurPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(
FilamentPrivacyBlurPlugin::make()
->defaultMode('blur_click')
->blurAmount(4)
->exceptColumns(['id', 'created_at', 'updated_at'])
->exceptPanels(['public'])
->enableAudit()
);
}
use Filament\Tables\Columns\TextColumn;
TextColumn::make('email')->private(),
// ❌ This will blur for EVERYONE, NO reveal allowed
TextColumn::make('email')->private()
// ✅ Only admins can reveal
TextColumn::make('email')
->private()
->visibleToRoles(['admin'])
// ✅ Users with 'view_email' permission can reveal
TextColumn::make('email')
->private()
->permission('view_email')
// Disable audit for specific field
TextColumn::make('public_field')
->private()
->withoutAuditReveal(),
// In browser: Shows blurred with click-to-reveal
// In export: Shows as "j***[email protected]"
TextColumn::make('email')->private()->maskUsing('email'),
// In browser: Shows blurred with click-to-reveal
// In export: Shows as "0812****7890"
TextColumn::make('phone')->private()->maskUsing('phone'),