terumi
terumi
FFilament
Created by terumi on 4/25/2024 in #❓┊help
Importing with extra data
Hello people, is it possible to import some data to the application using the csv importer but to add extra data using a select box? I want to do something like ImportColumn::make('campaign') ->relationship(Campaign::class, 'name'), ImportColumn::make('surname') ->requiredMapping() ->rules(['required']), Select::make('some_data') ->options(['asd', 'sasd', 'etc'])... Is that possible?
3 replies
FFilament
Created by terumi on 4/15/2024 in #❓┊help
Passing another Model to an Action instead of that that the Table iterates through
I know what I've written sounds convoluted but what I basically want to achieve is this: I have a table that takes a "fake" model that derives from a view-table in my database (because of "impossible" relations, max, mins etc). I display the data of the fake model "viewASDs" and on each row I have an edit function by which I want to edit the corresponding "ASD" model. I've set up the record() method of the table ( ->record(fn() => ASD::find($record->id)) ) but that seems to refer to something else. Whenever I try to call mutateRecordDataUsing(), using() etc, the methods take as an argument the viewASD model. Is there a way to perform actions to another model than the one that the table iterates through?
3 replies
FFilament
Created by terumi on 11/16/2023 in #❓┊help
Persist toggleable column state between sessions
Hello, It is a way to persist the toggled state of a column? Some of my users want to see their data by default deferently from others but I cannot find a way to persist their table. Is it possible?
13 replies
FFilament
Created by terumi on 10/17/2023 in #❓┊help
Multi-select update events?
Hello people, I have a multi-select form field that when a new items is added to it, does not trigger an event. I'm doing it like this:
Select::make('users')
->multiple()
->relationship('users', 'name')
->afterStateUpdated(function ($record, Select $component, $state) {
dd($state, $component, $record);
$record->users()->attach($state);
}),
Select::make('users')
->multiple()
->relationship('users', 'name')
->afterStateUpdated(function ($record, Select $component, $state) {
dd($state, $component, $record);
$record->users()->attach($state);
}),
Does anyone know how can I make the value addition/deletion update my record? Thank you!
2 replies
FFilament
Created by terumi on 10/10/2023 in #❓┊help
How to fill form in a custom page?
hello people. I made a new custom page on a resource with
php artisan make:filament-page ShowTicket --resource=TicketResource
php artisan make:filament-page ShowTicket --resource=TicketResource
Now, I want to display a form for the record I hooked up to the page using:
public function mount(int | string $record): void
{
//$this->fillForms();
$this->record = $this->resolveRecord($record);
}
public function mount(int | string $record): void
{
//$this->fillForms();
$this->record = $this->resolveRecord($record);
}
I made a form and I put it in the blade file. The form is being displayed but is isn't filled. I used fill() on the form but still the form is empty. Anyone knows what's wrong?
6 replies
FFilament
Created by terumi on 10/9/2023 in #❓┊help
Custom page model instance
Hello people, I made a new custom page for a filament resource with
php artisan make:filament-page ShowTicket --resource=TicketResource
php artisan make:filament-page ShowTicket --resource=TicketResource
And it created two files:
1. resources/views/filament/resources/ticket-resource/pages/show-ticket.blade.php, and
2. app/Filament/Resources/TicketResource/Pages/ShowTicket.php
1. resources/views/filament/resources/ticket-resource/pages/show-ticket.blade.php, and
2. app/Filament/Resources/TicketResource/Pages/ShowTicket.php
How can I pass now the instance of the model record whose view link I clicked? I'm being redirected to tickets/{ticket_id} but I cannot find anywhere how I can show the ticket properties. Any help would be greatly apreciated 🙂
7 replies