Clay Bitner
Clay Bitner
FFilament
Created by Clay Bitner on 1/17/2024 in #❓┊help
Adding a search to Tenant Menu
@if ($canSwitchTenants)
<div x-data="{ search: '' }">
@if(count($tenants) > 8)
<x-filament::input.wrapper>
<x-filament::input
type="text"
x-model="search"
placeholder="Search tenants..."
class="w-full rounded-md border border-gray-300 px-2 py-1 text-sm"
/>
</x-filament::input.wrapper>
@endif

<div class="max-h-90 overflow-y-auto">
@foreach ($tenants as $tenant)
<div x-show="search === '' || '{{ e(filament()->getTenantName($tenant)) }}'.replace(/ /g, '').toLowerCase().includes(search.replace(/ /g, '').toLowerCase())">
<x-filament::dropdown.list.item
:href="filament()->getUrl($tenant)"
:image="filament()->getTenantAvatarUrl($tenant)"
tag="a"
>
{{ filament()->getTenantName($tenant) }}
</x-filament::dropdown.list.item>
</div>
@endforeach
</div>
</div>
@endif
@if ($canSwitchTenants)
<div x-data="{ search: '' }">
@if(count($tenants) > 8)
<x-filament::input.wrapper>
<x-filament::input
type="text"
x-model="search"
placeholder="Search tenants..."
class="w-full rounded-md border border-gray-300 px-2 py-1 text-sm"
/>
</x-filament::input.wrapper>
@endif

<div class="max-h-90 overflow-y-auto">
@foreach ($tenants as $tenant)
<div x-show="search === '' || '{{ e(filament()->getTenantName($tenant)) }}'.replace(/ /g, '').toLowerCase().includes(search.replace(/ /g, '').toLowerCase())">
<x-filament::dropdown.list.item
:href="filament()->getUrl($tenant)"
:image="filament()->getTenantAvatarUrl($tenant)"
tag="a"
>
{{ filament()->getTenantName($tenant) }}
</x-filament::dropdown.list.item>
</div>
@endforeach
</div>
</div>
@endif
5 replies
FFilament
Created by Clay Bitner on 4/26/2024 in #❓┊help
View not found
Turns out the package used a capital "I" in Infolist rathern than the required folder name having a lowercase "i" as in infolist. Published the views then renamed the folder to get it to work.
4 replies
FFilament
Created by Tieme on 4/18/2024 in #❓┊help
Relationmanager in Livewire Infolist component
I just tried this plugin - works great locally, but can't seem to get it to work when releasing through Vapor. Not sure if there's some extra config needed.
9 replies
FFilament
Created by Dustfurn on 9/23/2023 in #❓┊help
EditTenantProfile bug?
Ever get this figured out?
3 replies
FFilament
Created by Clay Bitner on 1/17/2024 in #❓┊help
Adding a search to Tenant Menu
For anyone who's trying to figure it out themselves, I had the file in the wrong spot. It needed to go in reosources/views/vendor/filament-panels/components/tenant-menu.blade.php I was then able to add code to add a search box.
5 replies
FFilament
Created by Rikita on 11/22/2023 in #❓┊help
Got error Unable to find component: [app.filament.auth.edit-profile]
Did you ever figure out why this is happening? It's started happening to me too. I'm on version 3.2 and getting the error.
3 replies
FFilament
Created by codeartisan on 11/16/2023 in #❓┊help
Overriding the default reset password page
You want it to be
->passwordReset(\Filament\Pages\Auth\PasswordReset\RequestPasswordReset:class, Reset::class)
->passwordReset(\Filament\Pages\Auth\PasswordReset\RequestPasswordReset:class, Reset::class)
It's the second argument in the passwordReset function.
8 replies
FFilament
Created by Clay Bitner on 12/4/2023 in #❓┊help
Does Spatie Media Library work with Vapor over 4.5mb?
Turns out that somehwere along the line, whether that's in the Filament FileUpload or somewhere else, it does indeed send it to s3 directly, so it works with Vapor out of the box. I had to make sure that I had a few variables properly set in the .env file, but it works nicely:
ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS=true
FILAMENT_FILESYSTEM_DISK=s3
ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS=true
FILAMENT_FILESYSTEM_DISK=s3
21 replies
FFilament
Created by Clay Bitner on 12/4/2023 in #❓┊help
Does Spatie Media Library work with Vapor over 4.5mb?
So I was wondering if that's what might be happening in the backend, but can't figure out if it is or not.
21 replies
FFilament
Created by Clay Bitner on 12/4/2023 in #❓┊help
Does Spatie Media Library work with Vapor over 4.5mb?
The solution, as the vapor docs say, is to stream directly to S3 through js, and then use that js response to send the backend the completed file location.
21 replies
FFilament
Created by Clay Bitner on 12/4/2023 in #❓┊help
Does Spatie Media Library work with Vapor over 4.5mb?
It has something to do with the serverless nature of vapor. This is a direct quote from the vapor docs:
File Uploads ​ Due to AWS Lambda limitations, file uploads made directly to your application backend can only be up to roughly 4.5MB in size. This is a hard limit imposed by AWS, and updating the php. ini configuration file or any other configuration will not raise this limit.
File Uploads ​ Due to AWS Lambda limitations, file uploads made directly to your application backend can only be up to roughly 4.5MB in size. This is a hard limit imposed by AWS, and updating the php. ini configuration file or any other configuration will not raise this limit.
21 replies
FFilament
Created by Clay Bitner on 10/2/2023 in #❓┊help
Using Spatie's Laravel-permission, is there a way to assign roles to a pivot table?
Within the app, there are these groups where people can have chats and discussions and share pictures and the like. A user might have the role of "moderator" in one group (which allows them to add pictures, add new posts, remove posts, edit comments), but not another group, even if they are in both groups. In another group they may just have the role of "user" which allows them to view posts and pictures, for example. But a group exists within an organization (tenant), so there are multiple layers. From a UX perspective, when you add a user to a group, you'd want to define their role at the same time - because that's where the association lies.
5 replies
FFilament
Created by Clay Bitner on 10/2/2023 in #❓┊help
Using Spatie's Laravel-permission, is there a way to assign roles to a pivot table?
I've tried it in a few ways. First is within the UsersRelationManager within the GroupResource RelationManagers. Another place is within the UserResource when creating a user within the Tenant Admin panel. Inside the form, it looks like this:
return $form->schema([
Forms\Components\Section::make('User Details')
->schema([
Forms\Components\TextInput::make('first_name')
->required(),
Forms\Components\TextInput::make('last_name')
->required(),
Forms\Components\TextInput::make('username')
->required(),
Forms\Components\TextInput::make('email')
->required()
->email(),
Forms\Components\TextInput::make('password')
->required()
->password()
->maxLength(255)
->rule(Password::default())
->dehydrateStateUsing(fn ($state) => \Hash::make($state))
->visible(fn ($livewire) => $livewire instanceof Pages\CreateUser),
Forms\Components\CheckboxList::make('tenant_user.roles')
->relationship('roles', 'name'),
// ->preload(true)
]),
]);
return $form->schema([
Forms\Components\Section::make('User Details')
->schema([
Forms\Components\TextInput::make('first_name')
->required(),
Forms\Components\TextInput::make('last_name')
->required(),
Forms\Components\TextInput::make('username')
->required(),
Forms\Components\TextInput::make('email')
->required()
->email(),
Forms\Components\TextInput::make('password')
->required()
->password()
->maxLength(255)
->rule(Password::default())
->dehydrateStateUsing(fn ($state) => \Hash::make($state))
->visible(fn ($livewire) => $livewire instanceof Pages\CreateUser),
Forms\Components\CheckboxList::make('tenant_user.roles')
->relationship('roles', 'name'),
// ->preload(true)
]),
]);
Would you have any advice on how to approach it, though? Is there something I should be changing in the user model? I have these functions defining the groups and tenants within the User model:
public function groups(): BelongsToMany
{
return $this->belongsToMany(Group::class)->using(GroupUser::class)->withTimestamps();
}

public function tenants(): BelongsToMany
{
return $this->belongsToMany(Tenant::class)->using(TenantUser::class)->withTimestamps();
}
public function groups(): BelongsToMany
{
return $this->belongsToMany(Group::class)->using(GroupUser::class)->withTimestamps();
}

public function tenants(): BelongsToMany
{
return $this->belongsToMany(Tenant::class)->using(TenantUser::class)->withTimestamps();
}
5 replies
FFilament
Created by Trauma Zombie on 5/24/2023 in #❓┊help
Can you help me with the user hierarchy?
I'm facing the same issue. How did you end up integrating it and adding it to the RelationManager?
3 replies
FFilament
Created by jeremyb6 on 8/11/2023 in #❓┊help
Form Select `createOptionForm` in v3 Multi Tenant
I had the same problem, so I had to add: Forms\Components\Hidden::make('tenant_id')->default($tenant->id), to the $form schema and set $tenant = Filament::getTenant(); before the $form gets created.
4 replies