<?phpnamespace App\Helpers;use Filament\Infolists\Components\TextEntry;class TextEntryPremium{ public $hasAccess = false; public static function make(string $column): TextEntry { return TextEntry::make($column) ->formatStateUsing(fn(string $state): string => $this->hasAccess ? $state : __('Denied')) ->badge(fn() => !$this->hasAccess) ->icon(fn() => !$this->hasAcecss ? 'heroicon-o-lock-closed' : ''); }}
use App\Helpers\TextEntryPremium;public function profileInfolist(Infolist $infolist): Infolist { return $infolist ->record($this->profile) ->schema([ TextEntry::make('name'), TextEntryPremium::make('email'), ]); }
// customer functionpublic function applyPremiumDataRestrictions(string $column): TextEntry { return TextEntry::make($column) ->formatStateUsing(fn(string $state): string => $this->hasAccess ? $state : __('Denied')) ->badge(fn() => !$this->hasAccess) ->icon(fn() => !$this->hasAcecss ? 'heroicon-o-lock-closed' : '');}// inside schema$this->applyPremiumDataRestrictions('name')->label(__('Name)),