Wim
Wim
FFilament
Created by Wim on 8/9/2024 in #❓┊help
Fileupload to AWS S3
Thanks Dennis. I can confirm it was the ->visibility('private') part
5 replies
FFilament
Created by Wim on 8/4/2024 in #❓┊help
Conditionally showing TextInput or changing default
Anyone?
3 replies
FFilament
Created by Wim on 8/2/2024 in #❓┊help
Multi-tenant: search across all products
Hmmm, stupid I did not think about it, but it works ->getSearchResultsUsing(function ($search) { if (strlen($search) < 3) { return []; } return Product::where('name', 'like', "%{$search}%")->withoutGlobalScope('organization') ->limit(50) ->get() ->pluck('name', 'id'); })
11 replies
FFilament
Created by Wim on 8/2/2024 in #❓┊help
Multi-tenant: search across all products
It might be because it's Friday eve here, but how would I be able to combine the below. The first one is what is existing already and the second one I need to add. public static function getEloquentQuery(): Builder { return Topic::query(); } public static function getEloquentQuery(): Builder { return Product::query()->withoutGlobalScope('organization'); }
11 replies
FFilament
Created by Wim on 8/2/2024 in #❓┊help
Multi-tenant: search across all products
Confused a bit: 1) Not having a static::addGlobalScope on the Product Model works 2) Having a static::addGlobalScope on the Product Model does not give all products (which is understandable). Overwriting public static function isScopedToTenant() to false, it not giving all the products. 3) Having a static::addGlobalScope on the Product Model and overwrite the getEloquentQuery()in the MessageResource is sth I cannot do as it is already used for the MessageResource (the retrieval of the products is done in the MessageResource and there is already a getEloquentQuery() in place) 4) When I nevertheless add the getEloquentQuery() with a return Animal::query()->withoutGlobalScope('organization'); I get only the Products belonging to the organization again.
11 replies
FFilament
Created by Wim on 8/1/2024 in #❓┊help
Update a field based on select value
Thanks. This works perfectly!
4 replies
FFilament
Created by Wim on 7/25/2024 in #❓┊help
Open Edit modal from Action Group
Many thanks. Works!
4 replies
FFilament
Created by Wim on 7/23/2024 in #❓┊help
Navigation for custom page
Does not seem to work
6 replies
FFilament
Created by Wim on 7/19/2024 in #❓┊help
Redirect to app panel instead of admin panel
Correct, there is a $this->redirect(Dashboard::getURL()). But as said, that redirects to the Admin panel (as it's the default()). What I would like is that it redirects to the App panel. I have 'fixed' it as follows: if (Filament::getPanel()->getId() === 'admin') { Filament::getPanel('app')->auth()->login($user); $this->redirect(route('filament.app.resources.products.index', ['tenant' => $this->invitationModel->organization_id])); session()->regenerate(); } But this does not feel correct and efficient.
6 replies
FFilament
Created by Wim on 7/19/2024 in #❓┊help
Redirect to app panel instead of admin panel
In fact, when the invite user action I create an invitation entry in a table. Then the invited user clicks on the link in the mail and the following is executed public function create(): void {
$this->invitationModel = Invitation::find($this->invitation); $user = User::create([ 'name' => $this->form->getState()['name'], 'email' => $this->invitationModel->email, 'password' =>Hash::make($this->form->getState()['password']), ]); $user->organizations()->attach($this->invitationModel->organization_id); auth()->login($user); //this one goes to admin panel because it's default() but I need it to go to app (user) panel $this->redirect(Dashboard::getUrl()); }
6 replies
FFilament
Created by Wim on 7/19/2024 in #❓┊help
Redirect to app panel instead of admin panel
6 replies
FFilament
Created by Wim on 7/6/2024 in #❓┊help
Filtered resource in menu
Thanks. I know how to add a menu link but not how you show a subset of a resource (subset as in a resource with a where clause)? Any ideas?
3 replies
FFilament
Created by Wim on 5/24/2024 in #❓┊help
Custom view for Conversation with Messages
No description
12 replies
FFilament
Created by Wim on 5/24/2024 in #❓┊help
Custom view for Conversation with Messages
Thanks so much. I figured indeed it would indeed use a RepeatableEntry. I have an additional question if you don't mind: In the video you posted I see the reply button. I did that as follows:
TextEntry::make('Reply')
->hintAction(Action::make('openModal')
->button()
->label('Reply to this thread')
->form([
TextInput::make('content')
])
->action(function ($data, $record) {
// store into database
})),
TextEntry::make('Reply')
->hintAction(Action::make('openModal')
->button()
->label('Reply to this thread')
->form([
TextInput::make('content')
])
->action(function ($data, $record) {
// store into database
})),
12 replies
FFilament
Created by Wim on 5/24/2024 in #❓┊help
Infolist TextEntry
No description
5 replies
FFilament
Created by Wim on 5/24/2024 in #❓┊help
Infolist TextEntry
Many thanks sir! For my (future) information: this inlineLabel() does not seem to be mentioned in the docs. How could I have known?
5 replies
FFilament
Created by Wim on 5/24/2024 in #❓┊help
Custom view for Conversation with Messages
It's more or less what I try to build yes.
12 replies
FFilament
Created by Wim on 4/21/2024 in #❓┊help
Don't show Actions for Database notifications that are marked as read
OK thanks for the feedback. Was hoping to be able to use the read_at field in the database
3 replies
FFilament
Created by Wim on 4/20/2024 in #❓┊help
Favorite products: many to many not working
Thanks Povilas. I did follow your suggestion and found indeed something interesting. The query that gets executed is
select * from `products` where `products`.`id` in (2, 36) and `products`.`organization_id` in (2)
select * from `products` where `products`.`id` in (2, 36) and `products`.`organization_id` in (2)
I have a multi-tenancy setup and by default Filament is configured to only show the products that are part of the organization tenant. When I change the products (manually in the database) to belong to the logged in organization, the data will show correctly. When the products belong to other organizations, the information does not show. I have a middleware
ApplyTenantScopes
ApplyTenantScopes
as follows:
public function handle(Request $request, Closure $next): Response
{
Animal::addGlobalScope(
fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()),
);

return $next($request);
}
public function handle(Request $request, Closure $next): Response
{
Animal::addGlobalScope(
fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()),
);

return $next($request);
}
Not sure if there is a way to apply the global scope to all resources, except Favorites? Or perhaps there's better suggestions? Tried with
protected static bool $isScopedToTenant = false;
protected static bool $isScopedToTenant = false;
in the FavoriteResource but does not work
4 replies
FFilament
Created by Wim on 3/26/2024 in #❓┊help
Form validation messages
I'm using it in a regular form
public static function form(Form $form, ): Form
{
return $form
->schema([ ..])
}
public static function form(Form $form, ): Form
{
return $form
->schema([ ..])
}
so not in a Livewire custom form
18 replies