mxc
mxc
FFilament
Created by mxc on 4/12/2024 in #❓┊help
Modal Dialogue with scrollbars?
Hi all, I have a modal dialgue with a form with a repeater element. If the user adds a number of items via the repeater it get expanded below the bottom of the screen. Is there a way to add a scrollbar to the modal dialogue in filament3? Thanks
4 replies
FFilament
Created by mxc on 11/30/2023 in #❓┊help
Select Input populated via db query and setting default option?
Hi there, I have a select input that is populated by a db query. I am trying to set the default value both at load time and also dynamically when a variable is set but whatever I try to implement this it doesn't work. I am using the "default" method to populate at mount time but no luck. I am not sure how the
Select::make('Customer') ->options(Models\Customer::query() ->orderBy('Company Name') ->pluck('Company Name', 'Customer ID')) ->live() ->default(fn() => "1") ->afterStateUpdated(function ($state) { $this->customer = Models\Customer::find($state); }),'
For the dynamic update I am hoping that I can just reference the an object propery and have that update. Any ideas?
10 replies
FFilament
Created by mxc on 11/30/2023 in #❓┊help
Object of class Filament\Support\Enums\MaxWidth could not be converted to string
So I noticed my tables weren't showing the pagination badges so I google and came across a suggestion to run "composer upgraded" followed by "php artisan filament:upgrade". I got my pagination back but now any form I open I get the error "Object of class Filament\Support\Enums\MaxWidth could not be converted to string" Not sure how to fix this or wether its a bug in filament or something else. Any advice on how to sort this out? Thanks
4 replies
FFilament
Created by mxc on 11/9/2023 in #❓┊help
Document Library Browser?
Hi all, Does anyone know of a document library browser plugin? It needs to be able to do basic document/folder management/browsing with uploads and the ability to select files for download or select for attachment to an email? The documents will be stored on the server so not client side folder browsing. Thanks
2 replies
FFilament
Created by mxc on 11/8/2023 in #❓┊help
How to have an Action with a url() method, execute code before opening the link?
Hi there, I have an action object with a url link and I want to update the database when it is clicked. I can't get the database update to work in the action method or in any other method I tried. Is there a way to do this? Alternatively how do I open a link in the action method after updating the database?
Forms\Components\Actions\Action::make('appointment_entry')
->label('Calendar Entry')
->icon('heroicon-m-calendar-days')
->url(fn() => CustomerLink::where("id", "=", $this->customer->id)->get()->first()->url))
->openUrlInNewTab()
->action(function () {
$key = $this->initialise();
$counter = new Counter();
$counter->log_id = $key;
$counter->user_id = auth()->user()->id;
$counter->save();
})
Forms\Components\Actions\Action::make('appointment_entry')
->label('Calendar Entry')
->icon('heroicon-m-calendar-days')
->url(fn() => CustomerLink::where("id", "=", $this->customer->id)->get()->first()->url))
->openUrlInNewTab()
->action(function () {
$key = $this->initialise();
$counter = new Counter();
$counter->log_id = $key;
$counter->user_id = auth()->user()->id;
$counter->save();
})
12 replies
FFilament
Created by mxc on 10/26/2023 in #❓┊help
Overrding RequestPasswordReset page
Hi all, I have an existing user table that I need tomap into the authentication process. I have done this for the login page by extendng the existing Login page, overriding the required methods and then in AdminPanelProvider for $panel->login(MyLogin::class). I need to override methods in the requestpasswordreset page and probably the passwordreset page too but not sure how to get these 2 custom pages called instead of the default pages. There doesn't appear to be a method on $panel for this? Any help appreciated.
2 replies
FFilament
Created by mxc on 10/18/2023 in #❓┊help
Return infolist from component in a modal from an action?
Hi all, I want to have a modal popup from an action that displays an infolist. I have a livewire component with a method that returns infolist. I am trying to use the modalContent method from Action but not sure how to invoke the infolist method or how to get it to return html? I am trying to do this in a tables ->recordaction method. i.e when one clicks on a row a modal pops up displaying all the detail for that row. The below is my progress so far. and the code is jusst indicative of what I am trying to do to clarify the question.

...
])->recordAction('displayContact');
...
public function displayContact($record){
//return Action::make("View")->modalContent(view("livewire.customer-contact-infolist"));
return view("livewire.customer-contact-infolist",["record"=>"test"]);
}

...
])->recordAction('displayContact');
...
public function displayContact($record){
//return Action::make("View")->modalContent(view("livewire.customer-contact-infolist"));
return view("livewire.customer-contact-infolist",["record"=>"test"]);
}
From what I have read I may have to generate the HTML myself and send that to the modalcontent method but hoping to leverage the work already done creating the infolist in the component. thanks
4 replies
FFilament
Created by mxc on 10/17/2023 in #❓┊help
Modal Form in Action Specify Columns?
Hi all, I have an action that pops up a model form
Action::make("Add")
->icon("heroicon-m-plus")
->label("Add")
->form(...
Action::make("Add")
->icon("heroicon-m-plus")
->label("Add")
->form(...
The form method takes an schema array as input. How can I tell it I want it split in two columns? ->columns(2) doesn't work. This is in a Livewire component.
7 replies
FFilament
Created by mxc on 10/15/2023 in #❓┊help
Select component with searchable & live?
Hi all, I have a select box populated via a query that has the live method enabled as there is a dependent select whose options change depending on what is selected in the parent. If I enable searchable on the parent select the functionality doesn't work. A red box is placed around the parent select. The dependent select is not updated. It works fine if searchable is not enabled. I have tried adding debounce(600) as I have seen suggested by it doesn;t change the outcome.
Section::make()->schema([
Select::make('Customer')->options(Models\Customer::all()->pluck('CompanyName', 'ID')
->sort(function ($customer1, $customer2) {
return strtolower($customer1) <=> strtolower($customer2);
}))->label('Customer')
->live(),
//->searchable(),
// })->reactive(),
//->debounce(600),
Select::make('Contact')
->options(function (Get $get): Collection {
$customer_id = $get("Customer");
$results = Models\CustomerContact::where('CustomerId', $customer_id)->pluck('Name', 'CustomerContactID')
->sort(function ($customer1, $customer2) {
return strtolower($customer1) <=> strtolower($customer2);
});
return $results;
})
->label('Contact')
->searchable(),
Section::make()->schema([
Select::make('Customer')->options(Models\Customer::all()->pluck('CompanyName', 'ID')
->sort(function ($customer1, $customer2) {
return strtolower($customer1) <=> strtolower($customer2);
}))->label('Customer')
->live(),
//->searchable(),
// })->reactive(),
//->debounce(600),
Select::make('Contact')
->options(function (Get $get): Collection {
$customer_id = $get("Customer");
$results = Models\CustomerContact::where('CustomerId', $customer_id)->pluck('Name', 'CustomerContactID')
->sort(function ($customer1, $customer2) {
return strtolower($customer1) <=> strtolower($customer2);
});
return $results;
})
->label('Contact')
->searchable(),
4 replies
FFilament
Created by mxc on 10/8/2023 in #❓┊help
Custom route with path parameters for custom page
Hi there, I have create a custom page with
php artisan make:filament-page MyPage
php artisan make:filament-page MyPage
I would like to change the path and add a path parameter but can't find how to do it. I read I should override the method "public static function route($record)" in my page class but this has had no effect. How do I modify the route for a generated custom page? Thanks
8 replies
FFilament
Created by mxc on 10/1/2023 in #❓┊help
Resource Edit Form Not Populating Values - Model Field Names Mapped to Table Column Names
Hi all, I have to build a front-end on an existing database with horrendous and inconsistent naming of column names. I have mapped sensible names in the Model to the table column names with a bunch of get/set attribute methods. For example
public function setCompanyNameAttribute($company_name){
$this->attributes["Company Name"] = $company_name;
}
public function setCompanyNameAttribute($company_name){
$this->attributes["Company Name"] = $company_name;
}
When using plain blade templates I need to either map the form element ids to the exact column name or, in the controller, merge the request paramters with the database column names to get eloquent queries to work. When a model instance is used it all works fine and no extra work is needed. I now want to use filament forms to be able to list/edit/create etc the model objects. I can get the table method in my Resource to return and display the right columns using the model property names. Table is quite good as it can even use the database column names and still work. The issue I have is editing a row/model instance. The form displays but the existing values are not populated. If I enter data and save, the changes are saved. So far I have just replaced all values as the fields are required. I have searched, and queries chatgpt but can't find a way to be able to map the form fields and model properties to get the fields to populate the old values. Any ideas, pointers or solutions? Thanks
3 replies