Matthew
Matthew
FFilament
Created by Matthew on 11/5/2024 in #❓┊help
Filtering a Select Box
Has anyone successfully introduced functionality whereby they can filter a select box ? For example, if I have a an employees table and a document table, and I have a form that adds document records for employees... I'll have a select box that allows me to select the employee(s), but what if i wanted to enable the users to filter that list down, such as maybe all the employees with a certain grade etc ? I realise there are other ways to achieve something similar, like starting with the employees table and having bulk add... But wondered if anyone else had tried this approach ?
11 replies
FFilament
Created by Matthew on 11/5/2024 in #❓┊help
Override configureUsing ?
If I have a service provider with a boot method like:
public function boot() : void
{
CreateAction::configureUsing(function ($action) {
return $action->slideOver();
});
...
public function boot() : void
{
CreateAction::configureUsing(function ($action) {
return $action->slideOver();
});
...
How do I override a specific instance that I don't want as slide over ? I've tried ->slideover(false) & ->modal() without success. Thanks
5 replies
FFilament
Created by Matthew on 10/26/2024 in #❓┊help
Using rules on data not inside the form
Evening, I've want to make a field unique, but only within a subset. For example, if I am adding a Tag name, but I want that unique within a Type, but other Types could have the same name. I don't record the Type on the form, I add that to the DB using the ->mutateFormDataUsing method. So how do I make something like
->unique(modifyRuleUsing: function (Unique $rule, $data) {

return $rule
->where('cdt_type', $data('cdt_type'))

})
->unique(modifyRuleUsing: function (Unique $rule, $data) {

return $rule
->where('cdt_type', $data('cdt_type'))

})
Not that you can get $data in the unique() method, but cdt_type definitely not in $get
4 replies
FFilament
Created by Matthew on 10/23/2024 in #❓┊help
Create Action using different forms
Anybody got any suggestions on how to go about using a different form dependent on the type of record being added. I've got a table which holds different types of records, with a load of options that get stored in a Json format as a single column. Could therefore do with a different 'form' for each option. I can bring up an initial modal with a type select, but not sure how to advance that into a createAction with a dynamic form choice based upon the initial selection. Tried this:
public static function getTableHeaderActions() : array
{
return [
Action::make('chooseType')
->label('Choose Type of Element')
->form([
Select::make('cdf_type')
->label('Element Type')
->required()
->live()
->options(enumCdfType::getDropDownSelectOptions()),
])
->action(function (array $data) {
$selectedType = $data['cdf_type'];

return CreateAction::make('newElement')
->form(ClientDocFieldsForm::getFields(selectedType: $selectedType));

}),
];

}
public static function getTableHeaderActions() : array
{
return [
Action::make('chooseType')
->label('Choose Type of Element')
->form([
Select::make('cdf_type')
->label('Element Type')
->required()
->live()
->options(enumCdfType::getDropDownSelectOptions()),
])
->action(function (array $data) {
$selectedType = $data['cdf_type'];

return CreateAction::make('newElement')
->form(ClientDocFieldsForm::getFields(selectedType: $selectedType));

}),
];

}
But it doesn't fire a new modal.
2 replies
FFilament
Created by Matthew on 10/23/2024 in #❓┊help
getTabs() and limiting CreateAction options
Is it possible to determine which getTabs() option is enabled when launching an Action ? I want to split a table by getTabs() to various sections, and would like the CreateAction Header to respect that 'filter'
4 replies
FFilament
Created by Matthew on 10/17/2024 in #❓┊help
Global filter...how to refresh on change though.
I want a kind of global filter. Users are allocated locations, and their resources can be filtered by locations. I want to give users the functionality to select one or more of their permitted locations, and then for all their resources to be filtered accordingly. So far I have worked out how to: 1) Create the filter select in the header 2) Persist this throughout the session, across the panels 3) Apply the relevant global scopes dynamically to filter everything I am only missing one thing...which is when the select items are altered...it needs some sort of page refresh or change of resource to take effect. How can I make it reload everything on change ?
5 replies
FFilament
Created by Matthew on 10/15/2024 in #❓┊help
Widget Owner
If I've got a table widget in a view page (ViewRecord)...how am I getting the model of the record I am viewing ? tried getOwnerRecord()
5 replies
FFilament
Created by Matthew on 10/15/2024 in #❓┊help
Can you collapse widgets ?
Are widgets collapsible ?
7 replies
FFilament
Created by Matthew on 10/13/2024 in #❓┊help
Breezy & Filament::getTenant()
I have several pages sitting outside the panel, which I don't want to have to re-write from scratch as they are complicated, and we've got more urgent tasks. We had them workign an integrating fine, using the auth and even multi-tenancy. However, after installing Breezy, the Filament::getTenant() function, for pages outside of the panel is returning null Assume its got something to do with the auth changes, but not sure where to start with this ! Anyone seen anything similar or got any suggestions ?
2 replies
FFilament
Created by Matthew on 10/12/2024 in #❓┊help
Database notifications & tenancy
Anyone thought about\tried dealing with separating out database notifications for tenancy situations. Can you have notifications only showing on the active tenant ?
2 replies
FFilament
Created by Matthew on 10/9/2024 in #❓┊help
create button on wizard in modal, hide until end
I see some documentation on when a create wizard is used within a create page, about how to render the submit button on the last step. I can't find anything about when the wizard is within a modal\slideover. Is it possible to hide the create button until the end ?
7 replies
FFilament
Created by Matthew on 10/9/2024 in #❓┊help
Blank label and icon only on Action Button
No description
13 replies
FFilament
Created by Matthew on 10/8/2024 in #❓┊help
Table Actions and making variables more efficient
Interested in any opinions on how people avoid repeating code for issues where a table action, and elements of that are dependent on the status of $record For example, if:
Action::make('test')
->button()
->label(function ($record) :string {

if ($record->isTypeA())
{return 'Some text';
})

if $record->isTypeB())
{return 'Some different text';
})

->tooltip(function ($record) :string {

if ($record->isTypeA())
{return 'Some tootip text';
})

if $record->isTypeB())
{return 'Some different tooltip text';
}),
Action::make('test')
->button()
->label(function ($record) :string {

if ($record->isTypeA())
{return 'Some text';
})

if $record->isTypeB())
{return 'Some different text';
})

->tooltip(function ($record) :string {

if ($record->isTypeA())
{return 'Some tootip text';
})

if $record->isTypeB())
{return 'Some different tooltip text';
}),
Obviously a very basic example, but when you start adding a lot more methods, and increasing the complexity of the options, it can feel very cluttered and inefficient. How do people go about extracting some of this logic for the $record?
6 replies
FFilament
Created by Matthew on 10/7/2024 in #❓┊help
url styling with custom theme
No description
5 replies
FFilament
Created by Matthew on 10/6/2024 in #❓┊help
Themes and CSS and Hook Classes
Am I right in thinking using the fi hook classes and custom theme, I still wouldn't be able to influence classes like this one: I'm trying to move a hintaction to be right next to the label. If I change that element line to justify-start, it has the desired result. But I cannot get a custom theme to perform that. Some failed attempts look like this:
.fi-in-entry-wrp-hint {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

.fi-in-entry-wrp-label {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

fi-in-entry-wrp {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

fi-in-entry-wrp-hint-action {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}
.fi-in-entry-wrp-hint {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

.fi-in-entry-wrp-label {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

fi-in-entry-wrp {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}

fi-in-entry-wrp-hint-action {

@apply !flex inline-flex !items-start gap-x-3 !justify-start;

}
Is it possible ?
11 replies
FFilament
Created by Matthew on 10/4/2024 in #❓┊help
Route not defined ...cluster issue?
Good evening I started off with a navigation group called 'Finance', which I then later decide I wanted as a cluster. I built a cluster called 'Finance', moved the resources and undid the navigation group settings. I now get: Route [filament.customer.Finance.resource.invoice.view] not defined. I've tried clearing all the caches etc. I experimented with recreating a new cluster called 'Finances' , which worked. The OCD part of me though wants to keep it singular and solve this issue.
2 replies
FFilament
Created by Matthew on 10/3/2024 in #❓┊help
Default entry point at login
It would appear something somewhere is remembering the last resource\page that a user was on when they logout, and then going back to that when they re-login. A useful feature, but not always, how to switch it off?
2 replies
FFilament
Created by Matthew on 9/30/2024 in #❓┊help
reload \ refresh relation manager table on page action
Is there not an easy way to refresh the a table displayed by a relation manager, when an action on the resource view page completes ?
9 replies
FFilament
Created by Matthew on 9/30/2024 in #❓┊help
Livewire encountered corrupt data - Notifications
I've got an unexplained issue. When I try and put markdown in a Notification Body, as per docs, it throws a livewire issue: Livewire encountered corrupt data when trying to hydrate a component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests. I've stripped everything out in this example using just wom view page header actions:
Action::make('Test Not Work')
->label('Test Not Work')
->action(fn () => Notification::make()
->body(Str::markdown('Changes to the **post** have been saved.'))
->send()),

Action::make('Test Work')
->label('Test Work')
->action(fn () => Notification::make()
->body('Does work')
->send()),
Action::make('Test Not Work')
->label('Test Not Work')
->action(fn () => Notification::make()
->body(Str::markdown('Changes to the **post** have been saved.'))
->send()),

Action::make('Test Work')
->label('Test Work')
->action(fn () => Notification::make()
->body('Does work')
->send()),
The one without any markdown works fine, the other throws the :Livewire  \  Mechanisms  \  HandleComponents  \  CorruptComponentPayloadException error. Any ideas ?
6 replies
FFilament
Created by Matthew on 9/26/2024 in #❓┊help
Pass Model to re-useable Table Action
I've got a delete action which is repeated in various places. I want write the component in a helper class and then call it into the getTableActions array as required. To do this, I need to pass the model, but I can't make it work, it is passing a closure. Tried lots of iterations like this:
public static function getTableActions() : array
{
return [

TableAction::deleteApplication((function (Model $record) : Model {

return $record;
})
public static function getTableActions() : array
{
return [

TableAction::deleteApplication((function (Model $record) : Model {

return $record;
})
11 replies