adnn
adnn
Explore posts from servers
FFilament
Created by adnn on 7/2/2024 in #❓┊help
Split a Resource Form in multiple sub navigations?
I have a resource that requires a lot of form inputs for various things related to it. I would like to separate the Form into the navigation tabs so instead of having brand/2/edit and listing all fields at once it would be brand/2/edit/content, edit/administration, etc. while using the same model, not a relationship is this possible? if yes what's the proper way to go about it?
4 replies
FFilament
Created by adnn on 5/27/2024 in #❓┊help
Filter button placement?
No description
3 replies
FFilament
Created by adnn on 5/21/2024 in #❓┊help
different getOptionLabelFromRecordUsing for selected items?
Forms\Components\Select::make('website')
->live()
->label('Brand')
// ->required()

->multiple()
->relationship('website', 'name')
->allowHtml()
->getOptionLabelFromRecordUsing(fn (Website $record) =>
"<span class='font-semibold text-md'>{$record->name}</span> <br/>
<span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

)

->searchable(['name', 'domain'])
->preload(),
Forms\Components\Select::make('website')
->live()
->label('Brand')
// ->required()

->multiple()
->relationship('website', 'name')
->allowHtml()
->getOptionLabelFromRecordUsing(fn (Website $record) =>
"<span class='font-semibold text-md'>{$record->name}</span> <br/>
<span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

)

->searchable(['name', 'domain'])
->preload(),
Is it possible to have different html for the currently selected item? For example to only show the name on the Selected item, but show other things when searching items
2 replies
FFilament
Created by adnn on 5/19/2024 in #❓┊help
Use same infolist as page and modal when needed?
I have a resource with a view page infolist. I also want to add an Action in some other panel that would just open a peek infolist modal from that resource, rather than going to the page or having to copy paste the infolist in the action how can i achieve this?
7 replies
FFilament
Created by adnn on 5/15/2024 in #❓┊help
VS Code set up for Filament/Laravel development?
I'm coming from a Typescript react background, so I'm very used to just being able to command click on any type, method, function or whatever and for it to take me to it's definition. Whether it be my own, or something from a package. For example if I have a plugin for Media which has a ->getDefaultFolder(), if I want to find out anything more about what this does, I have to manually search and find it in the vendor folder.
However I can't seem to get this funcionality to work for Laravel and Filament at all. I've installed the Laravel Extension pack but it didn't do anything. There are 2 Filament specific plugins but both seem outdated. Does anyone know if I can do something to achieve the same funcionality as in React projects? I'm on Mac
6 replies
FFilament
Created by adnn on 5/15/2024 in #❓┊help
Baptiste job monitor multi tenancy?
How can I make this plugin work properly with tenants? It keeps saying
The model [Croustibat\FilamentJobsMonitor\Models\QueueMonitor] does not have a relationship named [team]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource] resource class.
The model [Croustibat\FilamentJobsMonitor\Models\QueueMonitor] does not have a relationship named [team]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource] resource class.
Usually I'd just add
protected static bool $isScopedToTenant = false;
protected static bool $isScopedToTenant = false;
to the Resource, but this one doesn't have a resource published so I'm not really sure where or how to do it https://filamentphp.com/plugins/croustibat-jobs-monitor
7 replies
FFilament
Created by adnn on 5/8/2024 in #❓┊help
Use a badge text column in ->form?
In my edit and view page i want to display a static item as a badge, is this achievable? Example something identical to this but for the form?
Forms\Components\TextInput::make('platform')
->label('Platform')
->url(fn ($record) => $record->url)
->color(fn (string $state): string => match ($state) {

default => 'gray'
}),
Forms\Components\TextInput::make('platform')
->label('Platform')
->url(fn ($record) => $record->url)
->color(fn (string $state): string => match ($state) {

default => 'gray'
}),
4 replies
FFilament
Created by adnn on 5/3/2024 in #❓┊help
Connecting the media library with entities?
I have a resource for product reviews that lists review, each review might have some images with it. Would it be possible to also have a media library to see all the review images at once, while also keeping the images in a relationship with the review, and assigning them to other reviews if needed? Also can I keep the images in something like google cloud or alike? I was looking at purchasing https://filamentphp.com/plugins/ralphjsmit-media-library-manager but want to ask if this would cover our use case?
2 replies
FFilament
Created by adnn on 4/26/2024 in #❓┊help
Resource not showing up in Roles? Filament shield
I created a new resource, but it's not showing up in shield/roles as a resource? I've ran php artisan shield:generate --all and even did php artisan shield:install and despite a policy existing and showing up in terminal, it's not visible on the filament page itself
| 7 | Taxonomy | TaxonomyPolicy.php :white_check_mark: | view_taxonomy, |
| | | | view_any_taxonomy, |
| | | | create_taxonomy, |
| | | | update_taxonomy, |
| | | | restore_taxonomy, |
| | | | restore_any_taxonomy, |
| | | | replicate_taxonomy, |
| | | | reorder_taxonomy, |
| | | | delete_taxonomy, |
| | | | delete_any_taxonomy, |
| | | | force_delete_taxonomy, |
| | | | force_delete_any_taxonomy :white_check_mark:
| 7 | Taxonomy | TaxonomyPolicy.php :white_check_mark: | view_taxonomy, |
| | | | view_any_taxonomy, |
| | | | create_taxonomy, |
| | | | update_taxonomy, |
| | | | restore_taxonomy, |
| | | | restore_any_taxonomy, |
| | | | replicate_taxonomy, |
| | | | reorder_taxonomy, |
| | | | delete_taxonomy, |
| | | | delete_any_taxonomy, |
| | | | force_delete_taxonomy, |
| | | | force_delete_any_taxonomy :white_check_mark:
what could the cause of this be?
3 replies
FFilament
Created by adnn on 4/16/2024 in #❓┊help
Is it possible to adjust the navigation panel width to be even smaller?
No description
3 replies
FFilament
Created by adnn on 4/15/2024 in #❓┊help
Better performance?
I have employed all the suggestions in https://filamentphp.com/docs/3.x/panels/installation#deploying-to-production however the load times for my tables are still unbelievably long, it feels like it's reading from the database every time a table is show, and even that is still longer than it should be Is there anything that can be done to improve this? Does filament cache the queries? Is there a way to add redis in between? I have a very beefy server on hetzner, the database is on the same server, and even so, a table with barely 200 records, showing only 10 , loads for good 2.7 seconds and I find it unacceptable for production
73 replies
FFilament
Created by adnn on 4/9/2024 in #❓┊help
Filament shield showing Roles managment to everyone
Out of the sudden, my shield/roles managment tab has become accessible to all users instead and the Role policy is not being taken into account? what could've caused this behaviour, i've tried doing php artisan shield:install again but it hasn't fixed it?
6 replies
FFilament
Created by adnn on 4/9/2024 in #❓┊help
Many relationship manager?
In my database I have brands and products I have a resource called Brand, and have tried making a relationship manager for Products. However, on my Brands table I don't have any product ids, because it can have hundreds. my products table has a brand_id column How do i properly set up this relationship in filament? Do I need to create an in between table?
11 replies
FFilament
Created by adnn on 4/8/2024 in #❓┊help
Infolist with pages?
I would like to have a table with infolist, as well as pages? Currently if I add pages for a site, cliking on the row takes me to the edit page. Can i make it so that clicking still opens infolist, but edit button takes you go to edit page?
4 replies
FFilament
Created by adnn on 4/3/2024 in #❓┊help
Call $livewire->js in header actions?
I have this table action which just opens a link with a token, it uses the livewire component to execute javascript because you can't open a link with php. Tables\Actions\EditAction::make(), Action::make('login') ->button() ->color('info') ->label('Log in') ->action(function (Website $website, Component $livewire) { //open wordpress link with token $token = self::generateToken($website->id); if (empty($token)) { Notification::make() ->title('Error: Token Generation Failed') ->danger() ->send(); return ''; } $url = 'https://www.' . $website->domain . '?token=' . urlencode($token); $livewire->js("window.open('{$url}', '_blank');"); i'm trying to have this same action in my edit page header actions, protected function getHeaderActions(): array { return [ Actions\DeleteAction::make(), Actions\Action::make('login') etc etc. ]} however getting various errors App\Filament\Resources\WebsiteResource\Pages\EditWebsite::App\Filament\Resources\WebsiteResource\Pages{closure}(): Argument #2 ($livewire) must be of type App\Filament\Resources\WebsiteResource\Pages\Component, App\Filament\Resources\WebsiteResource\Pages\EditWebsite given, called in vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35 did i go about this the wrong way, how can i achieve this?
5 replies
FFilament
Created by adnn on 3/25/2024 in #❓┊help
Add a button next to Resource create button?
No description
4 replies
FFilament
Created by adnn on 3/22/2024 in #❓┊help
Google Socialite Login CORS Error
I'm writing this post just to hopefully save some poor sod countless hours debugging in the future because I couldn't find anything myself in your app/Providers/Filament/AdminPanelProvider.php check if you have "->spa()" and remove it if you do. I spent 3 fucking days debugging this bullshit and in the end it was this and nothing to do with Google Login. For some reason with spa enabled it just returns this. Access to fetch at 'https://accounts.google.com/o/oauth2/auth?client_id=4939' (redirected from 'http://127.0.0.1:8000/auth/google') from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. From what I can tell when spa is enabled it's not sending the proper request headers at all.
1 replies
FFilament
Created by adnn on 3/20/2024 in #❓┊help
Multi tenant navigation panel?
No description
7 replies
FFilament
Created by adnn on 2/23/2024 in #❓┊help
How to use shouldDeselectAllRecordsWhenTableFiltered?
I want to keep the selections and NOT clear them when a user searches inside the table, came accross this https://github.com/filamentphp/filament/issues/5776 but not sure how I am supposed to use it?
5 replies