F alko
F alko
Explore posts from servers
FFilament
Created by F alko on 9/25/2024 in #❓┊help
Format state on empty column
I have table with width, height and length parameters. When showing this in the table, I want to add a size column That shows width x height x length.
Tables\Columns\TextColumn::make('width')
->label('Size')
->formatStateUsing(fn($record) => sprintf(
'%s x %s x %s mm',
$record->width ?? '?',
$record->height ?? '?',
$record->length ?? '?',
),
),
Tables\Columns\TextColumn::make('width')
->label('Size')
->formatStateUsing(fn($record) => sprintf(
'%s x %s x %s mm',
$record->width ?? '?',
$record->height ?? '?',
$record->length ?? '?',
),
),
However, when one is null, I want to show ? instead. When width is null, it doesn't hit the formatStateUsing method. Is there a way to make a virtual column that is always resolved?
5 replies
FFilament
Created by F alko on 9/6/2024 in #❓┊help
Format Pivot fields in Relation Manager
This is the table of my RelationManager. I have a many-to-many relation with a view properties on my pivot. I would like to add multiple pivot values together, but can't seem to find a way to do this. Let's say I have a User object with a many-to-many relation with Subscription. This many-to-many has a Pivot model called SubscriptionUser and pivot fields active and expires_at:
public function table(Table $table): Table
{
return $table
->allowDuplicates()
->columns([
Tables\Columns\TextColumn::make('some_pivot_field')
->formatStateUsing(function ($state, $record) {
// Here I would like to access UserRole.
// I want to be able to see every subscription and make the `active` state orange when expires at is within a month.
// This is not my actual use-case.
}),
]);
}
public function table(Table $table): Table
{
return $table
->allowDuplicates()
->columns([
Tables\Columns\TextColumn::make('some_pivot_field')
->formatStateUsing(function ($state, $record) {
// Here I would like to access UserRole.
// I want to be able to see every subscription and make the `active` state orange when expires at is within a month.
// This is not my actual use-case.
}),
]);
}
6 replies
TTwenty
Created by F alko on 7/21/2024 in #❓︱help
Google Auth no feedback
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID={{redacted}}.apps.googleusercontent.com
AUTH_GOOGLE_CLIENT_SECRET={{redacted}}
AUTH_GOOGLE_CALLBACK_URL=http://localhost:3001/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3001/auth/google-apis/get-access-token
MESSAGING_PROVIDER_GMAIL_CALLBACK_URL=http://localhost:3001/auth/google-apis/get-access-token
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID={{redacted}}.apps.googleusercontent.com
AUTH_GOOGLE_CLIENT_SECRET={{redacted}}
AUTH_GOOGLE_CALLBACK_URL=http://localhost:3001/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3001/auth/google-apis/get-access-token
MESSAGING_PROVIDER_GMAIL_CALLBACK_URL=http://localhost:3001/auth/google-apis/get-access-token
After trying Google Login locally, I get back on the login screen. Any clue how to debug this?
2 replies
TTwenty
Created by F alko on 7/19/2024 in #❓︱help
Cannot find field metadata item for field name somethingDeleted on object person
I deleted a field and now I can no longer go to the detail page.
10 replies
TTwenty
Created by F alko on 7/19/2024 in #❓︱help
Confirm deletions / disable deletion for some users
The delete button is very close to the export button when selecting records. Maybe we should add at least a confirmation when deleting.. I just deleted a lot by accident 😢
4 replies
FFilament
Created by F alko on 4/11/2024 in #❓┊help
Custom Image Edit fields
I have two cases where I need to do image manipulation in the frontend. One is an upload that people can draw on, another is an image that comes from a relation in another field and where you can add a marker. Should I try to change the ImageField or go completely custom here? Are there any great examples on canvas fields? 😄
1 replies
FFilament
Created by F alko on 11/20/2023 in #❓┊help
Vue.js / custom tooling in Filament
I'm looking into porting a custom application with some Laravel Nova to Filament, but we have a few custom tools build in Vue.js. Can we and should we implement these into the Filament application or should we try to avoid it and go for alpine? Rebuilding is gonna be costly, and we have a lot of experienced Vue developers. Our knowledge of alpine and Livewire is lacking, but we'll probably manage. If yes, how are we gonna achieve this? Is there an easy way to append our app.js to the custom Filament pages?
2 replies
FFilament
Created by F alko on 10/18/2023 in #❓┊help
Reusing actions
Is there any documentation on how to make a reusable actions? I find myself configuring the "empty table action" and "attach action" often the same.
15 replies
FFilament
Created by F alko on 9/26/2023 in #❓┊help
HTML in tooltip for table columns
Is there a reason why some tooltips support HTML and other don't? I need some line breaks in there, and thought nl2br would be my best bet..
4 replies
FFilament
Created by F alko on 9/22/2023 in #❓┊help
Issue with money formatting
Tables\Columns\TextColumn::make('price')
->money('eur', 100)
->sortable(),
Tables\Columns\TextColumn::make('price')
->money('eur', 100)
->sortable(),
I have a price field that is an unsigned integer contain the value 450. I expect to get €4.50, yet I get: €4.00. It seams to have a problem with minor units. Am I doing something wrong? I am on Filament v3.0.60 btw.
6 replies
FFilament
Created by F alko on 9/1/2023 in #❓┊help
I want to use multi tenancy for different tools that are set from the same panel
So currently I have a Tool resource which I have set at the Tenant, with a ToolType enum to differentiate which tool we are currently working on. Lets say we have a WineTool and a GiftBoxTool, then I want to have different resources available based on the ToolType. So for instance, with the WineTool we have CorkWrappers and for the GiftBoxTool we have BoxFilling (paper, hay, etc). Is there an easy way to hide the resources based on the tenant and a way to not have all relations set on the Tool model? When I have WineTool, I don't want to eager load the BoxFilling relation for instance.
3 replies
FFilament
Created by F alko on 8/17/2023 in #❓┊help
Customize ImageEditor to allow drawing
I want to customize the image editor to be able to draw on the image. Looking at what is in the Filament package, I'm pretty sure it is not really extendable and my Alpine experience isn't amazing. Any tips on how to get in there and change the popup to my own functionality ?
29 replies
FFilament
Created by F alko on 8/17/2023 in #❓┊help
Compile TailwindCSS for Panels V3
Hey guys, I am building a custom field for my panel. How do I compile the Tailwind classes for my panel to include these new blade files?
3 replies
FFilament
Created by F alko on 7/30/2023 in #❓┊help
Combination of Form and Table
Hey guys, I'm migrating from a Inertia / Vue.js application into a Livewire/Filament one. Currently we have a table with inputs for bulk editing. It's for a list of supplier specific products and their prices, making it easy to update in one form. The data to edit is in a Pivot table on the product_supplier table. What would be the best way to handle this in Filament? Is there a way to add form / input fields to a table or should I be looking into a custom page? If a custom page is the way to go, is there an easy way to use the Filament table and input components to make sure the styling is consistent? Thanks in advance! 🥹
6 replies
FFilament
Created by F alko on 7/28/2023 in #❓┊help
Infolist or widgets in forms
Can we add info lists into forms? I want to put it specifically into a form because I want to place it inside a tab.
12 replies
FFilament
Created by F alko on 7/28/2023 in #❓┊help
V3 Translations / i18n
Are there any plugins for translating the fields within a panel?
11 replies
FFilament
Created by F alko on 7/27/2023 in #❓┊help
Custom repeater validation
Hey guys, I have a repeater with some fields and a toggle like this:
Forms\Components\Repeater::make('someRepeater')
->schema([
Forms\Components\Toggle::make('someToggle'),
]),
Forms\Components\Repeater::make('someRepeater')
->schema([
Forms\Components\Toggle::make('someToggle'),
]),
I want to validate that only 1 of the fields can be active at the same time. Any tips on how to get this done?
6 replies