charlie
charlie
FFilament
Created by charlie on 2/21/2025 in #❓┊help
Would it be hard to move a complete Filament project to Multi-tenancy ?
Thanks to all of you. After a lot of thinking, I think I will go this way for now: - Each Company will have a separate install (1 subdomain, 1 database, 1 Laravel install) - On the main domain, i will install breeze, cashier, and try to make something simple - A scheduled task on main domain will post to a very minimal API in each subdomain if the subscription for that subdomain is ok or not. - Finally a simple middleware in each subdomain will check this status I prefer to have this separation to avoid a lot of concerns like security risks, database size, plugins compat, etc. The day I'll have more than 10 clients on this project, I will think about tenancy again. Let me know if you think that's a terrible solution 🙂
8 replies
FFilament
Created by charlie on 2/21/2025 in #❓┊help
Would it be hard to move a complete Filament project to Multi-tenancy ?
Ok, after reading the docs again. I do not need multi-tenancy. I just need simple one-to-many tenancy. Now I need to find the simplest way to bill my clients.
8 replies
FFilament
Created by charlie on 2/21/2025 in #❓┊help
Would it be hard to move a complete Filament project to Multi-tenancy ?
To be even more clear: The idea here would be: - a simple one-to-many tenancy (Users 1,2,3 belongs to Company 1 ; Users 4,5,6 belongs to Company 2) - if Company 1 subscription is up to date, then the Users 1, 2, and 3 will be able to use admin panel. It's so simple (at least in my mind) than I wonder if I really need multi tenancy. Although it seems I need it to use any billing system
8 replies
FFilament
Created by Yor on 2/20/2025 in #❓┊help
Navigation for multi role panel
in your case it's the viewAny() method
10 replies
FFilament
Created by Yor on 2/20/2025 in #❓┊help
Navigation for multi role panel
10 replies
FFilament
Created by Yor on 2/20/2025 in #❓┊help
Navigation for multi role panel
If they're regular resources, make sure your policy is correct. maybe the role query isn't ok?
10 replies
FFilament
Created by Yor on 2/20/2025 in #❓┊help
Navigation for multi role panel
I think for resources a policy should be enough. And for non resources, you could do the following:
->navigationItems([
NavigationItem::make('Horizon')
->url('/horizon', shouldOpenInNewTab: true)
->group('Admin')
->visible(fn(): bool => auth()->user()->hasRole('super_admin')),
->navigationItems([
NavigationItem::make('Horizon')
->url('/horizon', shouldOpenInNewTab: true)
->group('Admin')
->visible(fn(): bool => auth()->user()->hasRole('super_admin')),
10 replies
FFilament
Created by charlie on 2/11/2025 in #❓┊help
Disable a modal trigger
The PR is merged, release will come!
3 replies
FFilament
Created by charlie on 2/11/2025 in #❓┊help
Disable a modal trigger
I think it could easily be fixed by doing this quick change in vendor/filament/support/resources/views/components/modal/index.blade.php on line 108: Instead of
@if ($trigger)
<div
x-on:click="open"
{{ $trigger->attributes->class(['fi-modal-trigger flex cursor-pointer']) }}
>
{{ $trigger }}
</div>
@endif
@if ($trigger)
<div
x-on:click="open"
{{ $trigger->attributes->class(['fi-modal-trigger flex cursor-pointer']) }}
>
{{ $trigger }}
</div>
@endif
Do this:
@if ($trigger)
<div
@if(!$trigger->attributes['disabled'] ?? false)
x-on:click="open"
@endif
{{ $trigger->attributes->class(['fi-modal-trigger flex cursor-pointer']) }}
>
{{ $trigger }}
</div>
@endif
@if ($trigger)
<div
@if(!$trigger->attributes['disabled'] ?? false)
x-on:click="open"
@endif
{{ $trigger->attributes->class(['fi-modal-trigger flex cursor-pointer']) }}
>
{{ $trigger }}
</div>
@endif
Then in the view:
<x-slot name="trigger" :disabled="true">
<x-slot name="trigger" :disabled="true">
Should I propose a PR?
3 replies
FFilament
Created by Nikos Koukos on 2/7/2025 in #❓┊help
Accessing the selected records before firing a bulk action
oh gotcha
5 replies
FFilament
Created by Nikos Koukos on 2/7/2025 in #❓┊help
Accessing the selected records before firing a bulk action
Hi, you could do this for example with a custom BulkAction:
BulkAction::make('bulkEdit')
->name('My action')
->icon('heroicon-o-pencil')
->form([
Select::make('a_select_field')
])
->action(function (Collection $records, array $data) {
$data = array_filter($data);
return $records->each->update($data);
})
->deselectRecordsAfterCompletion(),
BulkAction::make('bulkEdit')
->name('My action')
->icon('heroicon-o-pencil')
->form([
Select::make('a_select_field')
])
->action(function (Collection $records, array $data) {
$data = array_filter($data);
return $records->each->update($data);
})
->deselectRecordsAfterCompletion(),
You also have the before() method:
Tables\Actions\DeleteBulkAction::make()
->before(function (Collection $records) {
// ...
})
Tables\Actions\DeleteBulkAction::make()
->before(function (Collection $records) {
// ...
})
5 replies
FFilament
Created by mathieutu on 1/21/2025 in #❓┊help
Simple repeater and $get
By the way, a big major version of Filament is about to come (no date yet), so if you're not in a hurry I'd advise to wait for it...
6 replies
FFilament
Created by mathieutu on 1/21/2025 in #❓┊help
Simple repeater and $get
Yeah, $get() doesn't query the DB, it gets the livewire object or something like that... What are you trying to do? Maybe I can help, I had some repeaters in my last project as well
6 replies
FFilament
Created by Tio Átila on 1/21/2025 in #❓┊help
Refresh badge count after filter table
try with something like:
->badge(fn () => $this->getFilteredTableQuery()->clone()->where('your_condition', true)->count())
->badge(fn () => $this->getFilteredTableQuery()->clone()->where('your_condition', true)->count())
2 replies
FFilament
Created by bald on 9/23/2024 in #❓┊help
Table's Query Builder is not shown shown in full width
try
// ...
->filters([
Tables\Filters\QueryBuilder::make()
->constraints([
Constraints\DateConstraint::make('start_date'),
Constraints\DateConstraint::make('end_date'),
])->columns(2),
])
// ...
->filters([
Tables\Filters\QueryBuilder::make()
->constraints([
Constraints\DateConstraint::make('start_date'),
Constraints\DateConstraint::make('end_date'),
])->columns(2),
])
(maybe...)
4 replies
FFilament
Created by mathieutu on 1/21/2025 in #❓┊help
Simple repeater and $get
Hi @mathieutu, that's the normal behavior if I'm not mistaken (nice to see you finally get into filament ;))
6 replies
FFilament
Created by morty on 1/21/2025 in #❓┊help
Is there a way to evaluate this immediately without returning a closure?
with two fields with hiddenOn('create') or hiddenOn('edit')?
4 replies
FFilament
Created by charlie on 1/19/2025 in #❓┊help
How to use Alpine in Filament?
wow, this feature is pure gold
26 replies
FFilament
Created by charlie on 1/19/2025 in #❓┊help
How to use Alpine in Filament?
Yeah, I did it!!! https://filament-theme-generator.charlie-etienne.fr/ Not even one server request! I don't know if it follows the best Alpine practices, but I manage to make it work and it's FAST Thanks to both of you @Leandro Ferreira and @ralphjsmit
26 replies
FFilament
Created by charlie on 1/19/2025 in #❓┊help
How to use Alpine in Filament?
oh, interesting, thanks
26 replies