Lara Zeus
Lara Zeus
FFilament
Created by Lara Zeus on 6/10/2024 in #❓┊help
how to expand section when there is some validation error in the child component
I want to implement this feature in my plugin accordion filament components has this feature when there is some errors in inputs inside the collapsed section or inactive tab they will be activated (the short video) how I can implement that in my plugin! or where I can find the source code for this part dont know what to call it or what to search for, checked the section.blade, but nothing clear to me
5 replies
FFilament
Created by Lara Zeus on 3/15/2024 in #❓┊help
[phpStan] Illuminate\Database\Eloquent\Model::$id.
getting the error on phpstan level 2 only which drive me crazy!!!! the code is from
public function canAccessTenant(Model $tenant): bool
{
return $this->belongsToCompany($tenant);
}
public function canAccessTenant(Model $tenant): bool
{
return $this->belongsToCompany($tenant);
}
and I cant change the signiter of the function and adding Company|Model wont help! should phpstan with larastan recognize the default laravel model attributes like id?
includes:
- vendor/larastan/larastan/extension.neon

parameters:

paths:
- app/

# Level 9 is the highest level
#level: 7
level: 2

# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php
#
# checkMissingIterableValueType: false
includes:
- vendor/larastan/larastan/extension.neon

parameters:

paths:
- app/

# Level 9 is the highest level
#level: 7
level: 2

# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php
#
# checkMissingIterableValueType: false
7 replies
FFilament
Created by Lara Zeus on 12/12/2023 in #❓┊help
split json between text field and hint action
this is a sign that I should go to sleep... 🙂 I have a column 'link' cast to array it's look like this
$link = [
'url' => 'https....',
'options' => [
'color'=>'red',
'target'=>'_blank',
//....
],
];
$link = [
'url' => 'https....',
'options' => [
'color'=>'red',
'target'=>'_blank',
//....
],
];
so my Input is:
TextInput::make('link.url')
->live()
->default('https://111')
->hintAction(
Action::make('qr-code-design')
->fillForm(function (Get $get) {
return [
'options' => $get('link.options'),
'url' => $get('link.url'),
];
})
->form([
Grid::make()
->schema([
TextInput::make('url')->default('https://222'),
TextInput::make('options.color')->default('#ccdd33'),
])
])
->action(function (Set $set, $data) {
$set('link', $data);
})
->color('gray')
->icon('heroicon-o-qr-code')
->tooltip('customize the QR code design')
->iconButton()),
TextInput::make('link.url')
->live()
->default('https://111')
->hintAction(
Action::make('qr-code-design')
->fillForm(function (Get $get) {
return [
'options' => $get('link.options'),
'url' => $get('link.url'),
];
})
->form([
Grid::make()
->schema([
TextInput::make('url')->default('https://222'),
TextInput::make('options.color')->default('#ccdd33'),
])
])
->action(function (Set $set, $data) {
$set('link', $data);
})
->color('gray')
->icon('heroicon-o-qr-code')
->tooltip('customize the QR code design')
->iconButton()),
the result after saving to db is {"url":"https:\/\/11111"} the options are never saved to db since they not exist in the main component is there a solution around this?! or better idea
5 replies
FFilament
Created by Lara Zeus on 11/21/2023 in #❓┊help
is it possible to have a Repeater in action form in a loop
I should go to sleep but I wont till resolve this 😅 in a lw component with loops for items and each item with an action :
{{ ($this->settings)(['item' => $id]) }}
{{ ($this->settings)(['item' => $id]) }}
in that action I have a form with repeater
->fillForm(function (array $arguments) {
$client = $this->client();
$getIndex = $client->getIndex($arguments['index']);
$settings = $getIndex->getSettings();

$filterableAttributes[$arguments['index'].'-filterableAttributes'] = $settings['filterableAttributes'];
return $filterableAttributes;
})
->form(function (array $arguments) {
return [
Repeater::make('filterableAttributes')
->simple(TextInput::make('filterableAttributes'))
->grid(2)
->statePath($arguments['index'].'-filterableAttributes')
->key($arguments['index'].'-filterableAttsssributes')
];

})
->fillForm(function (array $arguments) {
$client = $this->client();
$getIndex = $client->getIndex($arguments['index']);
$settings = $getIndex->getSettings();

$filterableAttributes[$arguments['index'].'-filterableAttributes'] = $settings['filterableAttributes'];
return $filterableAttributes;
})
->form(function (array $arguments) {
return [
Repeater::make('filterableAttributes')
->simple(TextInput::make('filterableAttributes'))
->grid(2)
->statePath($arguments['index'].'-filterableAttributes')
->key($arguments['index'].'-filterableAttsssributes')
];

})
it looks like any sup request will lose all the data in $arguments
20 replies
FFilament
Created by Lara Zeus on 11/21/2023 in #❓┊help
custom page action not opening
I have a custom page for a resource trying to add an action at the end of the form adding it to getHeaderActions work fine but not as asepreate action even adding <x-filament-actions::modals /> no effect not sure what i am missing! my Page:
protected function getHeaderActions(): array
{
// this dose ork
return [
Action::make('get-link-head')
->requiresConfirmation()
->action(function () {
dd(9);
}),
];
}

public function getLinkAction(): Action
{
// this dose not work
return Action::make('get-link')
->requiresConfirmation()
->action(function () {
dd(9);
});
}
protected function getHeaderActions(): array
{
// this dose ork
return [
Action::make('get-link-head')
->requiresConfirmation()
->action(function () {
dd(9);
}),
];
}

public function getLinkAction(): Action
{
// this dose not work
return Action::make('get-link')
->requiresConfirmation()
->action(function () {
dd(9);
});
}
view:
<x-filament-panels::page>
<x-filament-panels::form>
<div>
{{ $this->form }}
</div>

<div class="text-center">
{{ $this->getLinkAction }}
<x-filament-actions::modals />
</div>
</x-filament-panels::form>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament-panels::form>
<div>
{{ $this->form }}
</div>

<div class="text-center">
{{ $this->getLinkAction }}
<x-filament-actions::modals />
</div>
</x-filament-panels::form>
</x-filament-panels::page>
24 replies
FFilament
Created by Lara Zeus on 11/12/2023 in #❓┊help
using ImageColumn with data:image
I have an image in db stored as data:image
data:image/png;base64,iVBORw0KGgoAAAANSUhE.....
data:image/png;base64,iVBORw0KGgoAAAANSUhE.....
when using the ImageColumn the images not shown the source is always empty <img src class="" ... trace it back to
public function getImageUrl(?string $state = null): ?string
{
if (filter_var($state, FILTER_VALIDATE_URL) !== false ||
// added
str($state)->startsWith('data:')
) {
return $state;
}
public function getImageUrl(?string $state = null): ?string
{
if (filter_var($state, FILTER_VALIDATE_URL) !== false ||
// added
str($state)->startsWith('data:')
) {
return $state;
}
4 replies
FFilament
Created by Lara Zeus on 11/3/2023 in #❓┊help
change the widget type on the fly
can I set the widget type based on a filter value. the widget type is sooo protected and abstract 🙂 is that by design?
3 replies
FFilament
Created by Lara Zeus on 10/28/2023 in #❓┊help
wizard is not reactive
trying to add steps to a wizard when another component is updated full code: https://gist.github.com/atmonshi/1f9e2dc7e78a57423a0144979a3f9ba2 the step appears but the next button is not showing.
7 replies
FFilament
Created by Lara Zeus on 10/8/2023 in #❓┊help
repeater - anonymous action - fillForm
I have a repeater with anonymous action to open a modal inside a resource as:
Repeater::make('sections')
->label('')
->schema([
TextInput::make('name'),
Actions::make([
Action::make('more-options')
->fillForm(function ($data, $record): array {
dd($data, $record);
return [
'name' => $get('name'),
];
})
->form(function(){
return [
TextInput::make('name')
];
})
->action(function (Set $set, $data) {
$set('name', $data['name']);
}),
]),
])->relationship(),
Repeater::make('sections')
->label('')
->schema([
TextInput::make('name'),
Actions::make([
Action::make('more-options')
->fillForm(function ($data, $record): array {
dd($data, $record);
return [
'name' => $get('name'),
];
})
->form(function(){
return [
TextInput::make('name')
];
})
->action(function (Set $set, $data) {
$set('name', $data['name']);
}),
]),
])->relationship(),
and I want to get the data of the repeater item tried Get $get, $state, $data, $record but I am always getting only the first item in the Repeater when trying to access the record not sure what to inject there in fillForm BTW the same code works just fine when not inside a repeater! any idea?
7 replies
FFilament
Created by Lara Zeus on 9/8/2023 in #❓┊help
get breadcrumbs in a render hook
how I can access breadcrumbs in a render hook I want to move them to the topbar
->renderHook(
'panels::topbar.start',
fn (): View => view('filament.hooks.lang'),
)
->renderHook(
'panels::topbar.start',
fn (): View => view('filament.hooks.lang'),
)
and my view:
<div>
@if ($breadcrumbs)
<x-filament::breadcrumbs
:breadcrumbs="$breadcrumbs"
class="mb-2 hidden sm:block"
/>
@endif
</div>
<div>
@if ($breadcrumbs)
<x-filament::breadcrumbs
:breadcrumbs="$breadcrumbs"
class="mb-2 hidden sm:block"
/>
@endif
</div>
found this but where are the eggs 😅 $breadcrumbs coming from!? https://discord.com/channels/883083792112300104/883084832387760148/1141060061439987782
11 replies
FFilament
Created by Lara Zeus on 8/21/2023 in #❓┊help
using AsEnumArrayObject with enums
when I try to use AsEnumArrayObject in casting in my model:
protected $casts = [
'permissions' => AsEnumArrayObject::class.':'.Abilities::class,
];
protected $casts = [
'permissions' => AsEnumArrayObject::class.':'.Abilities::class,
];
in the table: Tables\Columns\TextColumn::make('permissions') I get
htmlspecialchars(): Argument #1 ($string) must be of type string, Illuminate\Database\Eloquent\Casts\ArrayObject given
htmlspecialchars(): Argument #1 ($string) must be of type string, Illuminate\Database\Eloquent\Casts\ArrayObject given
is it even possible to use AsEnumArrayObject with enums in filament? couldent see anything here https://filamentphp.com/docs/3.x/support/enums
3 replies
FFilament
Created by Lara Zeus on 8/5/2023 in #❓┊help
unexpected behavior in Repeater when contain a Toggle
filament v3.0.7 in a panel, a resource has a repeater, including text input and a toggle! there is unexpected behavior when adding or removing items some time won't delete, or delete with the next action (request), and when adding an item it will add two items or more. but if I disable the toggle or replace it with any other component the issue is gone!! (my actual repeater has so many fields with different types but I am testing in a fresh app) Initially I thought it's a LW queuing the requests or something like that, but when I removed the Toggle all good?! which now makes me crazier!! I let you watch the two videos... I have a repo ready if you want to test https://github.com/lara-zeus/test-fila-three/pull/3 but here is the simple code:
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name'),
Repeater::make('repeated_text')
->label('No Toggle')
->schema([
TextInput::make('name'),
//Toggle::make('aside'),
])->grid(2)
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name'),
Repeater::make('repeated_text')
->label('No Toggle')
->schema([
TextInput::make('name'),
//Toggle::make('aside'),
])->grid(2)
]);
}
13 replies
FFilament
Created by Lara Zeus on 8/2/2023 in #❓┊help
[UI] footer render hook in login page
5 replies
FFilament
Created by Lara Zeus on 7/30/2023 in #❓┊help
[plugins-dev] test: isDeferred does not exist
any idea why I am getting Method Filament\Panel::isDeferred does not exist. when testing a plugin! I think I am missing a provider or something?! the test:
get(CategoryResource::getUrl('index'))->assertSuccessful();
get(CategoryResource::getUrl('index'))->assertSuccessful();
result:
⨯ it can render Category List
────────────────────────────────────────────────────────────────────────────────
FAILED Tests\ResourcesTest > it can render Category… BadMethodCallException
Method Filament\Panel::isDeferred does not exist.

at vendor/filament/support/src/Concerns/Macroable.php:72
68▕ {
69▕ $macro = static::getMacro($method);
70▕
71▕ if ($macro === null) {
➜ 72▕ throw new BadMethodCallException(sprintf(
73▕ 'Method %s::%s does not exist.',
74▕ static::class,
75▕ $method,
76▕ ));

+10 vendor frames
11 tests/TestCase.php:38
⨯ it can render Category List
────────────────────────────────────────────────────────────────────────────────
FAILED Tests\ResourcesTest > it can render Category… BadMethodCallException
Method Filament\Panel::isDeferred does not exist.

at vendor/filament/support/src/Concerns/Macroable.php:72
68▕ {
69▕ $macro = static::getMacro($method);
70▕
71▕ if ($macro === null) {
➜ 72▕ throw new BadMethodCallException(sprintf(
73▕ 'Method %s::%s does not exist.',
74▕ static::class,
75▕ $method,
76▕ ));

+10 vendor frames
11 tests/TestCase.php:38
the same testing was green with v2. full changes: https://github.com/lara-zeus/bolt/pull/106
6 replies
FFilament
Created by Lara Zeus on 7/25/2023 in #❓┊help
adding trait Translatable will make all fields Translatable
@Dan Harrin
sorry to @ you 😅 continuing the discussion here I think it's easier and maybe others can help! the issue root: https://github.com/filamentphp/filament/issues/7156 long story short: when using the trait Translatable all none translateable attributes won't be saved. I found that there is two loops first one for $this->getTranslatableLocales() and the inside it another foreach getTranslatableAttributes it only saves one language, and on the next, it will revert to the original data, should it be saving only one lang, the selected one? attached a dump file
79 replies