Patrick
FBlog won't save post when TiptipEditor output is set to JSON.
I'm trying out the blog plugin for filament. I already had Tiptap editor installed and changed the config to save output as JSON.
This will result in an "array to string conversion" when trying to save the post. Added the
body
of the post to the $casts
as array solves it, but since the Post model resides in the vendor folder I can't edit this. Is there a way to work around this?8 replies
Can not add table to a component
I have a custom component where i want to display a table.
Implemented the trait and interface:
Now the problem is adding the table method, this expects to return a Table , but the underlying trait expects Static as return type.
This is according to the docs:
And when checking the trait HasTables, the method is like this:
So this will result in the following error:
Am I missing something or is this a bug?
4 replies
Show table action only when a specific filter is set
I would like to display a table action, but only when a specific filter is selected.
This works on the first request and there is a filter value in the GET:
But won't work when we select the filter after the page loads. I tried injecting but it can't resolve that.
Is there a way to do this?
3 replies
Setting a field value from an action
This is my action:
Actions\Action::make('gespreksverslag_herschrijven')
->label('Gespreksverslag herschrijven')
->icon('heroicon-o-pencil')
->action(function(){
$originalText = $this->data['conversation_report_original']; $service = new RewriteTextWithGPTService(); $rewrittenText = $service->handle(static::$prompt, $originalText); $this->form->fill([ 'conversation_report_gpt' => $rewrittenText, ], true);
}),
Im trying to fill the field 'conversation_report_gpt' but it's not filling anything. I also tried other things such as $this->data['conversation_report_gpt'] = $something and $set() but none of them works for me. This action resides in a Create page of resource
$originalText = $this->data['conversation_report_original']; $service = new RewriteTextWithGPTService(); $rewrittenText = $service->handle(static::$prompt, $originalText); $this->form->fill([ 'conversation_report_gpt' => $rewrittenText, ], true);
}),
Im trying to fill the field 'conversation_report_gpt' but it's not filling anything. I also tried other things such as $this->data['conversation_report_gpt'] = $something and $set() but none of them works for me. This action resides in a Create page of resource
3 replies
get a field value in an action
How can i get the value of a form field inside an action?
This is my action:
Actions\Action::make('gespreksverslag_herschrijven')
->label('Gespreksverslag herschrijven')
->icon('heroicon-o-pencil')
->action(function(Get $get){
$originalText = $get('conversation_report_original');
$service = new RewriteTextWithGPTService(); $rewrittenText = $service->handle(static::$prompt, $originalText); $this->form->fill(['conversation_report_gpt' => $rewrittenText]); }),
$get() will give m the following error: Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization It must be simple, but I can't find it in the docs. What am i missing?
$service = new RewriteTextWithGPTService(); $rewrittenText = $service->handle(static::$prompt, $originalText); $this->form->fill(['conversation_report_gpt' => $rewrittenText]); }),
$get() will give m the following error: Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization It must be simple, but I can't find it in the docs. What am i missing?
13 replies
How to implement a dynamic form in an action
I would like to display fields based on a database entry.
I have this action:
Now the returns an array with a schema
However, when i select an education the initial value just gets reset in the select instead of seeing the new form.
How can i do this?
7 replies
open action when a GET parameter is set
I'd like to open a specific action when a user comes to a page and a specific $_GET parameter is present.
It's an edit form of a resource, which contains a header action button. Which has a wireclick:
I would like to automatically open this action when my URL looks like this:
/admin/education/1/edit?openPlanningForm=true
Is there a way to do this? I was thinking of dispatching something in the mount method , but I don't know what i should dispatch.
My edit page:
Any tips?
21 replies
custom page throws error when adding trait InteractsWithRecord
I'm not sure what I'm missing. I've created a new custom page with this command:
Added the page to the resource, it displays, all good.
Now when I add trait to it, I get this error:
When i remove the ? from the trait for testing, i get the the message that resolveRecord does not exist.
This is my page:
What am i doing wrong?
7 replies
show changes with vite
I see i can include a custom stylesheet, but this would require me to build each time i make a change. I'm not sure how to do this.
I have a modal with a custom view, and i'd like to use tailwindcss and see the changes directly when Vite is running, but i can only find on how to include a processed css file
11 replies
Can't dynamicly show or hide fields in a repeater
I have a form with a select:
Further in the form, i have a Repeater
Now when i select a course that is a bundle, the course field should be visible, but nothing shows up.
When i change the Repeater to a Grid it works just fine, but i need to be able to add multiple entries.
9 replies
Calendar plugin will not show events unless we an array
calendar package works great, but it only works when i use an array as event data, when using the EventData class nothing shows up, except when i call toArray() myself
Without the toArray() the calendar stays empty. Not really a big issue, but it shouldn't be nessecary right?
5 replies
CSV import job is not executed
I've made an importer:
Now i added this import button to a relationmanager (Invitee)
When clicking the button, the modal appears, i can map my fields and then i get the noficiation that the Job is running on the background.
I have my queue_driver on SYNC, so that it should run directly.
After digging a little deeper, i found the trait that dispatches the job and sends the notification to the database.
$importChunkIterator = new ChunkIterator($csvResults->getRecords(), chunkSize: $action->getChunkSize()); /** @var array<array<array<string, string>>> $importChunks */ $importChunks = $importChunkIterator->get(); $job = $action->getJob(); $options = array_merge( $action->getOptions(), Arr::except($data, ['file', 'columnMap']), ); $importJobs = collect($importChunks) ->map(fn (array $importChunk): object => new ($job)( $import, rows: $importChunk, columnMap: $data['columnMap'], options: $options, )); Bus::batch($importJobs->all()) is always empty for some reason. The imports table in the database recieves the records, they are there. I'm not sure where to look now. Any idea's?
$importChunkIterator = new ChunkIterator($csvResults->getRecords(), chunkSize: $action->getChunkSize()); /** @var array<array<array<string, string>>> $importChunks */ $importChunks = $importChunkIterator->get(); $job = $action->getJob(); $options = array_merge( $action->getOptions(), Arr::except($data, ['file', 'columnMap']), ); $importJobs = collect($importChunks) ->map(fn (array $importChunk): object => new ($job)( $import, rows: $importChunk, columnMap: $data['columnMap'], options: $options, )); Bus::batch($importJobs->all()) is always empty for some reason. The imports table in the database recieves the records, they are there. I'm not sure where to look now. Any idea's?
26 replies