Mina
filter query join is not working for me
so, I am trying to make a filter with join on another table. The query is working fine but for some reason it's not working in filament. Do you have any idea why and if this is even possible to do, I really need this functionality on my page:
Tables\Filters\Filter::make('least_money_made')->query(function (Builder $query) {
return $query->select('funnels.*')
->leftJoin('orders', 'funnels.id', '=', 'orders.funnel_id')
->selectRaw('COALESCE(SUM(orders.total_price), 0) AS total_money_made')
->groupBy('funnels.id')
->orderBy('total_money_made', 'ASC')
->limit(1);
});
8 replies
Filament widget on click show table list record
Is it possible to make the widget clickable so that when you click it, it redirects you to a resource page. I am talking about dashboard widget. If it is possible, can someone please provide me with an example so that I can then modify it to suit my needs. Also if someone has an example where you click a widget, for example Active shops, and it renders a list of only active shops
6 replies
hiddenOn returns an error when creating a resource
So, on my app I had to add creation of whitelists. Before that you could only view the resource, you couldn't create it or edit it. Now, we had to add the creation of record. As you know, the view, edit and create are all using the same form. When creating a record now, we get an error:
App\Filament\Resources\WhitelistResource::App\Filament\Resources\{closure}(): Argument #1 ($record) must be of type App\Models\v1\Whitelist, null given, called in /var/task/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
I've looked through the code and realized it's because of this part:
Forms\Components\TextInput::make('planRelation.name')
->label('Plan')
->formatStateUsing((function (Whitelist $record): string {
return $record->planRelation->name ?? '';
}))
->hiddenOn(['edit', 'create']),
Right now we only removed it. My question is, how to actually make this work so that I have a planRelation name in the View page?5 replies
Searchable relationship
Hi, I am kinda new to filament still, maybe this was responded before but I really need help. I need to make the orders searchable by Funnel title. This is my relationship:
public function funnelRelation(): BelongsTo
{
return $this->belongsTo(Funnel::class, 'funnel_id', 'id');
}
This is the table column:
Tables\Columns\TextColumn::make('funnelRelation.title')->label('Funnel')->searchable()->sortable(),
I tried adding 'funnelRelation.title' as a condtition in searchale but I just get an error.3 replies
Excel export
hi everyone, I really need help with this, I need to generate a csv file with this data:
$user->name,
$user->owner_email,
$user->group,
$user->plan_name,
$user->lastRecurringCharge()->activated_on ?? null,
$user->lastRecurringCharge()->trial_ends_on ?? null,
$user->lastRecurringCharge()->status ?? null,
$user->created_at,
$user->updated_at,
$user->currency,
$user->shop_id,
$user->locale,
$user->timezone,
$user->plan->name ?? null,
Now, this lastRecurringCharge is a method and charges are a hasMany relationship. Since we can't use methods in column builder is there another way I can show this data? I tried with format state but that didn't work. I am pretty new to this so if I'm missing something please let me know
3 replies