ffffer.
ffffer.
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
Back to default within method
Hi, If I have the following code: Forms\Components\FileUpload::make('image') ->saveUploadedFileUsing(function() { if($get('storage') == 'images') { CODE } }) If the if is not satisfied, how can I get it to do the default method? That is, as if saveUploadedFileUsing has not been defined. My problem is that if the condition is not met, it doesn't work in all other cases. Thanks
5 replies
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
FileUpload for Cloudflare Images
Hi, I have a Forms\Components\FileUpload, and when editing, I want to show an image in a URL (not in the disk), something like: Forms\Components\FileUpload::make('image') ->formatStateUsing(function($record) { return 'https://picsum.photos/200'; }) (that code fails with error: foreach() argument must be of type array|object, string given) How can I show the image in the URL? Thanks
8 replies
FFilament
Created by ffffer. on 8/21/2024 in #❓┊help
RelationManager select relationship with multiple(), Duplicate entry on update
Hi, the following code in a RelationManager: public function form(Form $form): Form { return $form ->schema([ Forms\Components\Section::make() ->schema([ Forms\Components\Select::make('domains') ->relationship('domains','domain') ->multiple() ->preload(), With a belongsToMany from both Models to each other. When creating, there is no problem, but when updating and add more domains, I get: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'assets_content_domain.PRIMARY' insert into assets_content_domain (assets_content_id, domain_id) values (1, 2) Shouldn't it automatically manage that the record I am updating already exists? It's a bug? Thanks
10 replies
FFilament
Created by ffffer. on 2/29/2024 in #❓┊help
Builder schema not being reactive
Hi, I have this: Forms\Components\Builder::make('requirements') ->blocks([ Forms\Components\Builder\Block::make('data') ->schema(function (callable $get) { $type = $get('type'); Log::info($get('type')); }) ->reactive() And: Forms\Components\Section::make() ->schema([ Forms\Components\Select::make('other') ->options(function (callable $get) { Log::info($get('type')); return [$get('type')]; }) ->reactive(), Forms\Components\Select::make('type') ->options(['Option1' => 'Option1']) ->reactive() ->required(), In the Builder Block::make('data'), the Log is empty, but in the Select::make('other'), the Log is Option1. Why? How could I get the info from the select inside the Builder schema? Thanks
5 replies
FFilament
Created by ffffer. on 2/19/2024 in #❓┊help
Table does not edit the correct item
No description
5 replies
FFilament
Created by ffffer. on 2/15/2024 in #❓┊help
Pivot of pivot
Is it feasible to have a pivot of a pivot and use it within filament? For example a Relation Manager that has a relationship to a second pivot of the first pivot. Thanks
2 replies
FFilament
Created by ffffer. on 12/28/2023 in #❓┊help
Query Builder stored in DB
Query Builder is great for filtering users depending on the many options it has, but I would like to be able to store that filter logic applied so I can run it in laravel every time I launch a script for example. Let's say I want to define the filters, store them in the db, and then use them in laravel from time to time (obviously if stored filters are called after a while, the results will be different, so I don't want to store the results) Any ideas?
3 replies
FFilament
Created by ffffer. on 12/21/2023 in #❓┊help
Attach with dynamic fields
Hi, I'm trying to make a RelationManager attach, when a "Trigger" field is selected, show the fields of that Trigger, defined in an json options field (another option is a TriggersAttribute model). For example, the Trigger 'Signup', would have the fields: 'time_ago' (text) country_id' (numeric) Another Trigger will need different fields to be filled in. Let's say it is to make dynamic the attributes that I store in the pivot in a json. I have come up with this code: ->headerActions([ AttachAction::make() ->preloadRecordSelect() ->recordTitleAttribute('name') ->form(function (AttachAction $action) { return [ $action->getRecordSelect() ->reactive() ->afterStateUpdated(function (callable $set, $state) { $trigger = Trigger::find($state); if (!$trigger || empty($trigger->options)) { return; } foreach ($trigger->options as $field => $config) { if ($config['type'] == 'text') { $set('dynamicFields.'.$field, $config); } } }), TextInput::make('dynamic_name') ->label('Name') ->visible(fn(callable $get) => $get('dynamicFields.name.type') === 'text'), ]; }), ]) But I don't get what I'm looking for, could you help me?
5 replies
FFilament
Created by ffffer. on 12/14/2023 in #❓┊help
Inefficient table
No description
8 replies
FFilament
Created by ffffer. on 12/7/2023 in #❓┊help
Table with accessor content
No description
7 replies
FFilament
Created by ffffer. on 12/5/2023 in #❓┊help
Table inside Infolist
Hello to all, I would like to know if there is a way to insert a table into Infolist. I have infolist tabs, and in some of those tabs, I would like to have a table. If not, I don't know if it would be possible to make a more complex structure, where there would be tabs containing infolist on one side and tables on the other. Thanks for the advice, cheers
11 replies