caglar
caglar
FFilament
Created by caglar on 1/22/2024 in #❓┊help
How to use an icon like a button
I'd like to show and hide password by clicking the icon. Is it possible to apply?
7 replies
FFilament
Created by caglar on 1/18/2024 in #❓┊help
Infolist in a widget
Can we use an infolist in a widget?
2 replies
FFilament
Created by caglar on 1/17/2024 in #❓┊help
Testing copyableState() method in infolist
TextEntry::make('password')
->label('Password')
->getStateUsing(function ($record) {
$credential = $record->credentials()->where('loginunpw', 1)->first();

return $credential ? $credential->pass : 'No Password Found';
})
->formatStateUsing(fn ($state): string => Str::mask('secret', '*', 0))
->copyable()
->copyableState(fn (string $state): string => $state)
->copyMessage('Copied!'),
TextEntry::make('password')
->label('Password')
->getStateUsing(function ($record) {
$credential = $record->credentials()->where('loginunpw', 1)->first();

return $credential ? $credential->pass : 'No Password Found';
})
->formatStateUsing(fn ($state): string => Str::mask('secret', '*', 0))
->copyable()
->copyableState(fn (string $state): string => $state)
->copyMessage('Copied!'),
For above code I have a test
it('shows login credentials of an assets object', function () {
/** @var AssetsObject $object */
$object = AssetsObject::factory()
->has(IPv4::factory()
->state(['mainip' => 1]),
'ipv4Addresses'
)
->hasAttached(
Credential::factory(),
['loginunpw' => 1]
)
->create();

livewire(ViewObject::class, [
'record' => $object->getKey(),
])
->assertSuccessful()
->assertSeeText('Main IP')
->assertSeeText(long2ip($object->ipv4Addresses()->where('mainip', 1)->first()->startip))
->assertSeeText('User')
->assertSeeText($object->credentials()->where('loginunpw', 1)->first()->user)
->assertSeeText('Type')
->assertSeeText($object->credentials()->where('loginunpw', 1)->first()->credentialsType->name)
->assertSeeText('Password')
->assertSeeText('******');
});
it('shows login credentials of an assets object', function () {
/** @var AssetsObject $object */
$object = AssetsObject::factory()
->has(IPv4::factory()
->state(['mainip' => 1]),
'ipv4Addresses'
)
->hasAttached(
Credential::factory(),
['loginunpw' => 1]
)
->create();

livewire(ViewObject::class, [
'record' => $object->getKey(),
])
->assertSuccessful()
->assertSeeText('Main IP')
->assertSeeText(long2ip($object->ipv4Addresses()->where('mainip', 1)->first()->startip))
->assertSeeText('User')
->assertSeeText($object->credentials()->where('loginunpw', 1)->first()->user)
->assertSeeText('Type')
->assertSeeText($object->credentials()->where('loginunpw', 1)->first()->credentialsType->name)
->assertSeeText('Password')
->assertSeeText('******');
});
and I'd like to test
->copyableState(fn (string $state): string => $state)
->copyableState(fn (string $state): string => $state)
It copies password value to clipboard.
2 replies
FFilament
Created by caglar on 1/15/2024 in #❓┊help
How to replace a password with asteriks in an infolist but keep the value to copy
I have a password field in my infolist and I'd like to convert it into asteriks like ** but at the same time I want to keep it copyable with its real value
TextEntry::make('password')
->label('Password')
->getStateUsing(fn ($record) => $record->credentials()->where('loginunpw', 1)->first()->pass)
->copyable()
->copyMessage('Copied!'),
TextEntry::make('password')
->label('Password')
->getStateUsing(fn ($record) => $record->credentials()->where('loginunpw', 1)->first()->pass)
->copyable()
->copyMessage('Copied!'),
7 replies
FFilament
Created by caglar on 1/15/2024 in #❓┊help
copyable() method doesn't copy the value
No description
4 replies
FFilament
Created by caglar on 1/12/2024 in #❓┊help
Infolist doesn't show the table on the browser
I'd like to use infolist in my project and I added it into my resource but it doesn't show any table on the browser. I don't get any error. Besides I'm using filament sidebar package. Can anybody help me?
35 replies