trovster
trovster
FFilament
Created by trovster on 9/7/2023 in #❓┊help
CAPS in resource headings
4 replies
FFilament
Created by trovster on 9/7/2023 in #❓┊help
Extend Component, set optional schema based on flag
I have moved complex schema sections to new classes, which I then include in the resource. In the extended component I set up the schema for fields. This works nicely and I am able to override things such as the heading that was set in the custom component. I can't work out how to conditionally make visible/hidden components. ```php // In the resource I want MyCustomSection::make()->heading('Example')->simple(); class MyCustomSection extends Section { protected bool $simple = false; public function simple() { $this->simple = true; } protected function setUp(): void { parent::setUp(); $this ->heading(class_basename(static::class)) ->schema([ ... //more fields DatePicker::make('modified')->hidden($this->simple), ]); } }
5 replies
FFilament
Created by trovster on 8/25/2023 in #❓┊help
Extra modal actions, trigger edit modal action and open link
I have a simple resource that has view and edit screens appearing as modal, using the ->actions() method. I have added two buttons to the footer of the modal, but I can't work out how to trigger their actions. I want the “View” button to open the resources' permalink in a new tab. And I want the “Edit” button to open the EditAction modal action – the getUrl doesn't work because there is no edit page, just the modal.
Tables\Actions\ViewAction::make()
->color('info')
->modalCancelAction(false)
->extraModalFooterActions(fn (Tables\Actions\ViewAction $action): array => [
$action->makeModalAction('view')
->color('info')
->icon('heroicon-m-eye')
->url(static fn (Model $model): string => $model->permalink)
->openUrlInNewTab(),

$action->makeModalAction('edit')
->color('warning')
->icon('heroicon-m-pencil-square')
// ->url(static fn (Model $model): string => self::getUrl('edit', ['resource' => $model]))
,
]),

Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make()
->color('info')
->modalCancelAction(false)
->extraModalFooterActions(fn (Tables\Actions\ViewAction $action): array => [
$action->makeModalAction('view')
->color('info')
->icon('heroicon-m-eye')
->url(static fn (Model $model): string => $model->permalink)
->openUrlInNewTab(),

$action->makeModalAction('edit')
->color('warning')
->icon('heroicon-m-pencil-square')
// ->url(static fn (Model $model): string => self::getUrl('edit', ['resource' => $model]))
,
]),

Tables\Actions\EditAction::make(),
2 replies
FFilament
Created by trovster on 8/23/2023 in #❓┊help
How do I create an Infolist Link?
I want to add a "download" link to an ImageEntry but ->downloadable() is only available for the FileUpload form component. For example, the following creates a link, but it's not styled nicely (even though I have some basic classes) and seems a little clunky. It also doesn't appear nicely directly below the ImageEntry I have used above.
TextEntry::make('src')
->label('Download')
->hiddenLabel()
->html()
->state(static fn (Model $model): string => "<a href='{$model->src}' class='fi-link fi-link-size-sm text-info' download>Download</a>"),
TextEntry::make('src')
->label('Download')
->hiddenLabel()
->html()
->state(static fn (Model $model): string => "<a href='{$model->src}' class='fi-link fi-link-size-sm text-info' download>Download</a>"),
8 replies
FFilament
Created by trovster on 8/22/2023 in #❓┊help
Infolist ImageEntry doesn't support `extraAttributes()`
TextEntry supports extra attributes, as documented, but this doesn't seem to work for the ImageEntry component. The following appears on TextEntry component view, but such code is missing from ImageEntry.
attributes="Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())->class(['fi-in-text'])
attributes="Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())->class(['fi-in-text'])
2 replies
FFilament
Created by trovster on 8/21/2023 in #❓┊help
Testing for Infolist actions (hintAction)
I have a Filament\Infolists\Components\TextEntry with a hintAction. Are there any action test methods for these? I am using ->test(Resource\View::class, ...) and assertActionExists works for actions setup in getHeaderActions`. But this fails for those on the infolist components.
6 replies
FFilament
Created by trovster on 8/21/2023 in #❓┊help
Modal Action description & label not set
3 replies
FFilament
Created by trovster on 8/17/2023 in #❓┊help
Remove Axis from Chart (Pie)
5 replies
FFilament
Created by trovster on 8/7/2023 in #❓┊help
Using Table within a custom widget
I have generated a basic widget and would like to use the Table system to output a table, but I can't work out what I need to do! Where should I look?
4 replies
FFilament
Created by trovster on 8/7/2023 in #❓┊help
Using contracts resolved in AppServiceProvider
I am trying to use a contract which is resolved in the AppServiceProvider, in the Filament\AdminPanelProvider panel config. But it is not resolved at this point as Filament\AdminPanelProvider seems to be registered first, even though it appears after the main provider in the config/app.php How can I change this order?
20 replies
FFilament
Created by trovster on 8/7/2023 in #❓┊help
Using domain causes CORS issues
I have built a brand-new V3 admin using a custom (sub)-domain. However, I get a CORS error when using certain functionality, because JS for them are loaded using asset() which looks at the .env APP_URL, which is the main applications URL, not my subdomain. How can I fix this?
46 replies