trovster
trovster
FFilament
Created by trovster on 10/8/2024 in #❓┊help
Creating a widget returns an error.
I have a widget on my panel and it was working fine. I have bumped composer dependencies, run the upgrade command and cleared views, but I now get an error;
Unable to find component: [app.filament.widgets.stats-overview]
Unable to find component: [app.filament.widgets.stats-overview]
If I follow the stats overview documentation to create a new widget and add it to my dashboard, I get the same error.
8 replies
FFilament
Created by trovster on 7/25/2024 in #❓┊help
Image Editor Height/Width
I want to create an image which is a specific size. I defined height (400) and width (270) constants that I am using and I have built the FileUpload component like the following. However, after using the image editor, it crops the image incorrectly. It creates an image a few pixels smaller than required! How can I create an image with the exact sizes I want.
FileUpload::make('poster')
->panelAspectRatio($this->aspectRatio())
->imageCropAspectRatio($this->aspectRatio())
->imagePreviewHeight((string) Movie::POSTER_HEIGHT)
->imageResizeTargetHeight((string) Movie::POSTER_HEIGHT)
->imageResizeTargetWidth((string) Movie::POSTER_WIDTH)
->image()
->imageEditor()
->imageEditorAspectRatios([
$this->aspectRatio(),
]);

protected function aspectRatio(): string
{
return Movie::POSTER_WIDTH . ':' . Movie::POSTER_HEIGHT;
}
FileUpload::make('poster')
->panelAspectRatio($this->aspectRatio())
->imageCropAspectRatio($this->aspectRatio())
->imagePreviewHeight((string) Movie::POSTER_HEIGHT)
->imageResizeTargetHeight((string) Movie::POSTER_HEIGHT)
->imageResizeTargetWidth((string) Movie::POSTER_WIDTH)
->image()
->imageEditor()
->imageEditorAspectRatios([
$this->aspectRatio(),
]);

protected function aspectRatio(): string
{
return Movie::POSTER_WIDTH . ':' . Movie::POSTER_HEIGHT;
}
7 replies
FFilament
Created by trovster on 7/25/2024 in #❓┊help
Hide Actions on RelationManager
I am using ExampleResource::table($table) in a RelationManager. This includes all the actions that appear on that resource's table. When I call ->actions() to add a "DetachAction", this is added correctly. However, I would like a way of removing existing actions or resetting them. I tried the hiddenOn() behaviour that is available for table columns. Is this possible for actions?
9 replies
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(),
3 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