qcol
qcol
FFilament
Created by qcol on 1/5/2024 in #❓┊help
Import action - CSV of "failed rows" delimiter
When I import CVS, I can set delimiter by ->csvDelimiter(';'). But how to set delimiter in auto created CVS of "failed rows"?
3 replies
FFilament
Created by qcol on 12/9/2023 in #❓┊help
unwanted "order by" in modifyQueryUsing - how to disable it?
No description
11 replies
FFilament
Created by qcol on 12/6/2023 in #❓┊help
groupBy, SUM and custom TextInput in table row?
No description
2 replies
FFilament
Created by qcol on 11/8/2023 in #❓┊help
Action confirmation and form modal doesn't work with custom page
I need an action button that collects additional data before executing the action. This works with the panel builder, unfortunately it doesn't work on the custom page. The confirmation doesn't work either, the code from the save() function is executed immediately. What am I doing wrong?
Code: https://gist.github.com/qcol/081aaaf289315751340695406a1bc766
2 replies
FFilament
Created by qcol on 10/30/2023 in #❓┊help
Open modal when You click on a placeholder
No description
2 replies
FFilament
Created by qcol on 10/19/2023 in #❓┊help
Custom hierarchical (tree) table - filament or custom row by row?
I am trying to build a hierarchical table that will include row grouping, collapsing and expanding groups (tree structure). One of the columns must contain textinput, at the end of the table a submit button to save changes. The package https://github.com/staudenmeir/laravel-adjacency-list is very helpful here. I am doing tests with database queries and with this package I can easily build a tree structure in plain HTML.
Trying to do this in the Filament table but right at the beginning I have a problem because I can't use the query->(Product::find($product_id)->descendants) because package generate ready to use collection, so there is an error (query must be Builder|Closure|null, Collection given) Question 1. How to get around the error to be able to use the filament table?
Question 2. It is possible that the best way, however, would be to build such a table outside the filament, with loop, row by row. How to do it to use filament components (table with grouping/collapse/expansion)?. Is there somewhere an example of building such a custom table (I can't find)?
3 replies
FFilament
Created by qcol on 10/10/2023 in #❓┊help
Call to a member function getKey() on null
Hi, I am trying to use a custom class to create a record. According to the documentation, https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create#customizing-the-creation-process
"$model is the class name of the model, but you can replace this with your own hard-coded class if you wish." That's why I'm using it like this:
->using(function ($livewire, array $data, Tables\Actions\CreateAction $action): Void { WhdocMovesClass::move($data, $livewire, $action); }) In my class, I make many calls and writes to the database. The operations execute correctly, however, I get an error at the end: Call to a member function getKey() on null I read somewhere that the function should return a Model, but in my case in ->using() many operations are executed on the database, so how to return one model?
5 replies
FFilament
Created by qcol on 9/27/2023 in #❓┊help
SpatieTags filter
This is probably a problem more Laravel than Filament.... But maybe someone can tell me how to create a filter for SpatieTags? The name column is json type, so I try as below and only have sequence numbers instead of names in Select (1,2,3,4) SelectFilter::make('tags') ->relationship('tags', 'id') ->options(Tag::getWithType('company_types') ->pluck('name->pl', 'id') )
10 replies
FFilament
Created by qcol on 9/4/2023 in #❓┊help
Nested resource
Hi! How do you currently solve the problem of nested resources? I have such tables: Orders -> product_sets -> product_set_items Products are managed by relation manager. When I enter an order I can see the products table under the order. However, the product sets have items. When I click on one of the product_set columns, I should be taken to edit product_set_items. Is there an example somewhere where I can preview such a solution? I don't see anything like that in the demo. I saw on roadmap the idea of nested resources. I can't wait, that would be brilliant 🙂
7 replies
FFilament
Created by qcol on 8/28/2023 in #❓┊help
Textinput value like Placeholder content?
In Placeholder::make('name')->content() I can "listen" to the other live() fields of the form and dynamically change the value of content depending on the other fields. How to do similarly with the value of the Textinput field? I know that during form initialization I can use ->default() but I am concerned with editing the form.
26 replies
FFilament
Created by qcol on 8/25/2023 in #❓┊help
afterStateHydrated() doesn't work?
6 replies
FFilament
Created by qcol on 8/22/2023 in #❓┊help
afterStateUpdated and field changed by $set()
The documentation says that afterStateUpdated does not work when a field changes via $set(). Sometimes, however, instead of the user, the field is just changed by $set(). How to deal with this? For example, I have qty, price and total fields. The price field is ->live() and has afterStateUpdated() in which I set the total field after changing the price value. However, in some situations, the price field is set by $set(). How then to update the total field?
11 replies
FFilament
Created by qcol on 8/12/2023 in #❓┊help
Dynamic number of select fields
Hi! I have tables: sets: id, name groups: id, name set_groups: id, group_id, set_id elements: id, name, group_id The user creates himself any sets and groups, and assigns elements to the groups. I would like to create a form such that when a set is selected, as many select fields are displayed as the set contains groups, so: Set #1 a) group #1 (Select field with elements assigned to the group) b) group #2 (as above) c) group #4 d) group #8 Set #2 a) group #2 b) group #8 c) group #10 Set #3 a) group #2 b) group #8 So each set has a different number of different groups and so when Set#1 is selected 4 select fields should appear, when Set #2 is selected 3 select fields should appear and when Set #3 is selected only 2 select fields should appear. Finally, the user selects items from each group. My first thought is to make, say, 10 fixed select fields for the groups and hide/unhide only as many as needed. However, I am afraid that the user will need more groups than 10, so the safest thing would be to use a FOR loop to build as many select fields as needed for a given set. Can you give me a hint on the easiest way to do this?
3 replies
FFilament
Created by qcol on 8/9/2023 in #❓┊help
TagsColumn searchable()?
I am trying to use the TagsInput field but in such a way that I can filter or search for records by tag. TagsColumn::make('tags')->separator(',')->searchable() doesn't work - it doesn't search for records with tags. Also, TagsColumn is marked as 'depraced'. I also don't see in the documentation the use of a filter with tags, the only example on Discord I can find is for spatie-tags. So should I use spatie-tags to be able to filter data by tags?
46 replies
FFilament
Created by qcol on 8/8/2023 in #❓┊help
Confirm modal inside beforeSave hook?
Is it possible to use the confirm modal in the beforeSave hook? I perform a number of actions in beforeSave, some of which require confirmation. Is it possible to confirm some of the actions inside the hook?
8 replies
FFilament
Created by qcol on 8/8/2023 in #❓┊help
$set and Placeholder content
I have a Select element, after selecting which I wanted to change the content of the Placeholder element. Select is ->live() however if I try in ->afterStateUpdated to give $set("my_placeholder",$new_data) - the placeholder content does not change. On TextInput fields $set works fine. How to do this?
5 replies
FFilament
Created by qcol on 8/6/2023 in #❓┊help
Conditionally hiding user navigation items
In the documentation there is a description of how to hide the main menu items (NavigationItem visible/hidden). However, this does not work for the user menu in the top right corner (userMenuItems -> MenuItem). I would like to conditionally display these items depending on user permissions. How do I do this?
6 replies
FFilament
Created by qcol on 8/3/2023 in #❓┊help
afterStateHydrated - how to fill in other fields in 'create' mode?
I need to fill in some empty fields when creating a record. Set does not work if operation = create (in edit it works fine).
16 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
Repeater with partially predefined values?
I have 3 tables: products: id, name prices: product_id, price_type_id, price price_types: id, name (unique) So the user can add any number of price types. A price of each type should be added for each product. Is it possible, for example, to add a repeater with partially predefined values? This would display a list with all price types (name filled), only the price field would have to be completed? How to solve this?
4 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
summarize and custom model attribute
Hi I have a model attribute: protected function sumRetail(): Attribute { return Attribute::make( get: fn () => $this->price_retail * $this->qty ); } And I would like to summarize the sum_retail column. With this notation, summarize does not work, but row summation works: TablesColumnsTextColumn::make('sum_retail')->label('Value.')->alignRight() ->summarize(Sum::make()->numeric(decimalPlaces: 2)), With this notation, summarize works, but row summation does not work. TablesColumnsTextColumn::make('price_retail * qty')->label('Value')->alignRight() ->summarize(Sum::make()->numeric(decimalPlaces: 2)), So how should this be correct?
9 replies