Travis
Travis
FFilament
Created by Travis on 3/5/2024 in #❓┊help
Can I use import options to allow the user to define the CSV delimiter?
I would like to use the import action and I can see that one can introduce custom options for the user to select, and I can see that I can set the CSV delimiter, but what I can't see is how I can use the user's custom option to dictate the CSV delimiter. Does this make sense? I looked through the documentation and the code, but it doesn't look like the options are available in a place/time/way where it can be used. Please point me in the right direction if you know anything. 🤓
4 replies
FFilament
Created by Travis on 2/19/2024 in #❓┊help
Can I use Import/Export functionality outside of filament?
We have an app that has export functionality. We roll our own. Would it be possible to import filament/actions and then to create an Exporter class that is then instantiated and invoked? Assuming the batches/notifications tables exist along with the filament actions migrations, then I would assume it would all work. Has anyone tried this? Does anyone know of any reason why this wouldn't work? Thanks in advance. 🤓
4 replies
FFilament
Created by Travis on 2/18/2024 in #❓┊help
Image Selector
Is it possible to use the RichEditor or MarkdownEditor to select images from S3? Is there anything in the documentation that covers how one can do this? I have seen some instructions on how one uploads via the two editor components I mentioned, but it doesn't seem like it's possible to select from those that have already been uploaded. Thx.
3 replies
FFilament
Created by Travis on 12/9/2023 in #❓┊help
Bug in extraModalFooterActions arguments
I am using extraModalFooterActions for a couple of actions to "clear" some data. Here's an example of the code in question:
->extraModalFooterActions(fn (Action $action): array => [
$action->makeModalSubmitAction('clearData', arguments: ['clear' => true]),
])
->extraModalFooterActions(fn (Action $action): array => [
$action->makeModalSubmitAction('clearData', arguments: ['clear' => true]),
])
When I click on the extra "clear data" modal footer action button, the specified action callable is called, but the $arguments argument is an empty array. I have been fighting this for a while today and finally downgraded from v3.1.17 => v3.0.95, just randomly picking a version more than two weeks old, which was when it was last working. I will try to narrow this down and mabye create a simple repo to link to that demonstrates the problem, but it will have to be tomorrow at the earliest. Still, I wanted to post this to get the word out....hoping someone might have more time/energy and possibly help. I'll try to follow up tomorrow with some more info.
2 replies
FFilament
Created by Travis on 11/11/2023 in #❓┊help
Why "promote" pivot columns when building a table for an Eloquent relationship...?
Please refer to this documentation: https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component#automatically-generating-table-columns It says that "all pivot columns [can be used] as if they were normal columns on your table, as long as they are listed in the withPivot() method of the relationship and inverse relationship definition." Why is this the case...? I have a BelongsToMany relationship that I would like to use in the way that the documentation describes, but my related model's attributes have the pivot columns mixed in with them. This seems very odd and I worry about "clashing" fields. Can someone please help me understand why this is designed to work this way...? 🤔
1 replies
FFilament
Created by Travis on 11/3/2023 in #❓┊help
Is there an error in `Filament\Table\Table::defaultSort()`...?🤔
I was trying to pass a Closure to defaultSort() for the second argument, $direction for a table that I have. Here is the latest version of defaultSort() in Filament\Tables\Table:
trait CanSortRecords
{
protected ?string $defaultSortColumn = null;

protected ?string $defaultSortDirection = null;

protected ?Closure $defaultSortQuery = null;

protected bool | Closure | null $persistsSortInSession = false;

public function defaultSort(string | Closure | null $column, string | Closure | null $direction = 'asc'): static
{
if ($column instanceof Closure) {
$this->defaultSortQuery = $column;
} else {
$this->defaultSortColumn = $column;
}

if ($direction !== null) {
$direction = Str::lower($direction);
}

$this->defaultSortDirection = $direction;

return $this;
}
trait CanSortRecords
{
protected ?string $defaultSortColumn = null;

protected ?string $defaultSortDirection = null;

protected ?Closure $defaultSortQuery = null;

protected bool | Closure | null $persistsSortInSession = false;

public function defaultSort(string | Closure | null $column, string | Closure | null $direction = 'asc'): static
{
if ($column instanceof Closure) {
$this->defaultSortQuery = $column;
} else {
$this->defaultSortColumn = $column;
}

if ($direction !== null) {
$direction = Str::lower($direction);
}

$this->defaultSortDirection = $direction;

return $this;
}
Seems like passing $direction to Str::lower() when $direction is a Closure causes an exception: mb_strtolower(): Argument #1 ($string) must be of type string, Closure given Am I doing this wrong, or is this an error...? Seems like this is an error to me.
28 replies
FFilament
Created by Travis on 10/19/2023 in #❓┊help
Is it possible to allow guests or unauthenticated users access to a panel...?
With v3, it seems that filament is less of an admin panel builder and is presented as a possible "customer-facing app...or anything you can imagine". I would like to be able to use filament as a website or app that anyone can visit and have access to some resources without having to register or login. Then, of course, if they choose to register and login, they would be able to do/see a bit more. I'd love to hear whether or not this is possible...using the v3 panel builder. (I know one can use table/form builder and other filament "components" on "normal Laravel" routes, but this is not what I'm talking about.) Thanks in advance for any help/input/answers. 🤓
11 replies
FFilament
Created by Travis on 9/18/2023 in #❓┊help
How to use FileUpload to simply upload a file...? 🤔
I have a Image resource that has a few basic attributes: filename, disk, directory, size, height, and width. I also have an ImageResource Filament resource class for the Image model. I want to use FileUpload to create new Image models, but I feel like I'm missing something. At the moment, the form is simply one FileUpload component and there's a Select component that allows the user to select an existing directory or create a new one. The idea is that when the user uploads a file and selects a directory, then a new Image will be created and the file will now reside in the specified directory in our s3 bucket. I have hard-coded the disk and am preserving the filename. Everything appears to work correctly when I choose a file, select a directory, and then hit Create....except, I can't find the file in our s3 bucket. I can see the image in my storage/app/livewire-tmp folder, but this is not supposed to be its final home. Everything appears to be successful, but in the end I can't find the image file anywhere. 😢
6 replies
FFilament
Created by Travis on 9/14/2023 in #❓┊help
Is it possible to sort a table by a relation field...? 🤔
I have a table that displays grouped data. The data is grouped by a (date/time) field on one of the resource's relations, which works great. But, I would like to sort the table on this same field. It doesn't seem to be possible....unless I've missed something...? 😳 Does anyone know whether or not this is possible...? 🤔
16 replies
FFilament
Created by Travis on 8/31/2023 in #❓┊help
How to test simple resources in v3...?
I am upgrading a project from v2 to v3 and we have a lot of tests for simple resources...that is, those that have one page that descends from ManageRecords. I can't find anything in the (test) docs and I've searched through the various filament repos, but I've not found anything and I'm not sure what to do now. Can anyone help...? 🤔 Thx in advance...
2 replies
FFilament
Created by Travis on 8/18/2023 in #❓┊help
Custom form page submit button isn't styled
16 replies
FFilament
Created by Travis on 8/13/2023 in #❓┊help
(Table) Repeater relationship options
When using the repeater (or the Table Repeater plugin), it will show the same BelongsToMany relationship options even if they've already been selected. 😢 How does one (easily) avoid this...? 🤔 I have tried to inject $get or $livewire, but I'm not having good results. Wherever I try to inject the latter, I'm told it's expecting a different type than the Livewire\Livewire class. And $get seems to work, but I can't seem to actually get all of the other items to exclude them from the list of available options. 😒 Thx in advance.... 🤓
75 replies
FFilament
Created by Travis on 8/5/2023 in #❓┊help
How to test non-default panel...?
I'm trying to test a non-default panel -- the edit tenant profile class, to be more specific -- and it seems like I'm missing something. It seems like the test environment isn't aware of the different panels that have been created. Can anyone point to any examples of how to test functionality that belongs to a non-default panel...? 🤔 I don't think it matters, but the panel supports multiple tenants.
9 replies
FFilament
Created by Travis on 8/2/2023 in #❓┊help
Getting wrong data for `count(*)` field 😢
For a table query, I call select() to specify a handful of non-standard "fields". One of them is specified like this: DB::raw('count(*) as current_result') Then, I define the column like so: Tables\Columns\TextColumn::make('current_result') The column appears, but every value is 1. I'm using laravel debugbar and I can copy the query that is executed and it generates a bunch of results for current_result that are not 1. Do I have to do something special to set up a column for such data...? I feel like I'm missing something, but I can't figure it out. 😳
4 replies
FFilament
Created by Travis on 8/2/2023 in #❓┊help
Connection bug when using Summarizer(s)...? 🤔
I have a table that is otherwise working. When I add a summarizer to a column, I get the following error:
SQLSTATE[42000]: Syntax error or access violation: 1049 Unknown database 'mydatabasename'
SQLSTATE[42000]: Syntax error or access violation: 1049 Unknown database 'mydatabasename'
It also shows the sql, which looks fine, but it indicates that the connection is the default connection and not the correct connection, which is not the default. (I have multiple connections in this application.) So, without the summarizer, all is fine. Add the summarizer and the aforementioned error occurs. While I may have missed something, I did poke around in the Summarizer class(es) to try to find anything related to DB connections. Any thoughts...? 🤓
2 replies
FFilament
Created by Travis on 8/2/2023 in #❓┊help
ComponentNotFoundException on Tenant Registration
I am getting an error when I register a new tenant. I'm not sure how the multiple panels should work together, but I have a widget on my default panel that provides a link to another panel's tenant route. This lands the user on the panel's tenant registration page when they have no tenants. The form can be filled out, but when submitting, an error occurs. It's a Livewire ComponentNotFoundException...where it can't find app.filament.pages.tenancy.register-organization. (My panel's tenant registration form class is App\Filament\Pages\Tenancy\RegisterOrganization::class.) It appears that this happens before the handleRegistration() method is called. Any input, advice, answers...or whatever...? 🤔 Thanks in advance. 🤓
22 replies
FFilament
Created by Travis on 7/25/2023 in #❓┊help
Login::authenticate() inject credentials...?
Hi, First of all, I'm enjoying the v3 beta so far. Thx. 🤓 I have extended the default Login because we have a use-case where we need to log in using a username and password. We make changes to the form, but then we override the authenticate() method...copying/pasting the whole thing and then changing 'email' to 'username'. Is there a better way to do this...? Would it be worthwhile to submit a PR to allow for one to inject credentials and/or somehow allow for a custom version of the following code?
if (! Filament::auth()->attempt([
'username' => $data['username'],
'password' => $data['password'],
], $data['remember'])) {
throw ValidationException::withMessages([
'data.username' => __('filament::pages/auth/login.messages.failed'),
]);
}
if (! Filament::auth()->attempt([
'username' => $data['username'],
'password' => $data['password'],
], $data['remember'])) {
throw ValidationException::withMessages([
'data.username' => __('filament::pages/auth/login.messages.failed'),
]);
}
Thanks again...! 👍
2 replies
FFilament
Created by Travis on 6/8/2023 in #❓┊help
Attach Option Form...?
According to the docs (https://filamentphp.com/docs/2.x/forms/fields#creating-new-records), I can use createOptionForm() for a BelongsTo relationship. Is it possible to do something like attachOptionForm() for a BelongsToMany relationship, allowing the user to set values for the many-to-many intermediate/pivot table...? If so, any docs/links/examples...? If not, any advice/suggestions on how to allow a user to attach many-to-many relationships (with pivot attributes) when creating/editing...?
12 replies
FFilament
Created by Travis on 5/31/2023 in #❓┊help
How to use table builder to manage many-to-many relationship
Does anyone have any experience using the table builder package to create a table to manage a many-to-many relationship? I have a simple many-to-many relationship with one of my models, Profile, and another one, Attributes. I set up the table component to list the profile's attributes. I set up getTableQuery() to return `Profile::attributes()->getQuery(). This works great.... Then, I add the AttachAction to the table's header actions, and this is where things begin to fall apart:
protected function getTableHeaderActions(): array
{
return [
Tables\Actions\AttachAction::make()
->relationship($this->profile->attributes())
->inverseRelationshipName('profile')
->recordTitleAttribute('name'),
];
}
protected function getTableHeaderActions(): array
{
return [
Tables\Actions\AttachAction::make()
->relationship($this->profile->attributes())
->inverseRelationshipName('profile')
->recordTitleAttribute('name'),
];
}
Trying to attach an attribute starts out fine: button, modal, dropdown...and when you type something, the generated query works and correctly returns the right data, but then it displays the same (wrong) value for each attribute: 'attribute'. Does anyone have any experience/examples...? Any suggestions/guidance...? 🤔
31 replies
FFilament
Created by Travis on 5/29/2023 in #❓┊help
External validation and state path...
I believe I've encountered this before and I have searched discord, but to no avail. I am using Form Builder and in one form I'm calling an external class to update a model on "save". The external class performs the validation, but it's not "registering" with the filament/livewire component when it fails because I am scoping the form data to an array property...a la https://filamentphp.com/docs/2.x/forms/getting-started#scoping-form-data-to-an-array-property. Can anyone point me in the right direction on what to do?
34 replies