Ian Tasker
Ian Tasker
FFilament
Created by Andrew Wallo on 8/5/2023 in #❓┊help
Understanding Multi-Tenant Architecture in Filament V3
On point 3 it looks like it will need a custom page like breezy has for the user profile.
5 replies
FFilament
Created by Andrew Wallo on 8/5/2023 in #❓┊help
Understanding Multi-Tenant Architecture in Filament V3
1. There is a event for TenantSet which you can listen to to update the field on the user to store which tenant they are one. 2. Afaik Filement will use the tenant returned in getDefaultTenant as the current tenant. 3. I am at this point, so far I found no way to display users for a tenant using a relation manger or other method when using the existing Profile method.
5 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
summarize and custom model attribute
<?php

namespace App\Tables\Components\Columns\Summarizers;

use Exception;
use Filament\Tables\Columns\Summarizers\Summarizer;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\Schema;

class SumAttribute extends Summarizer
{
protected function setUp(): void
{
parent::setUp();

$this->numeric();
}

/**
* @return int | float | array<string, array<string, int>> | null
*/
public function summarize(Builder $query, string $attribute): int | float | array | null
{
$column = $this->getColumn();
$isField = Schema::hasColumn($this->getQuery()->getModel(), $column->getName());

if ($isField) {
throw new Exception("The [{$column->getName()}] column must be an Attribute.");
}

$limit = $this->getQuery()->getQuery()->limit;
$offset = $this->getQuery()->getQuery()->offset;
return $this->getQuery()->getModel()->get()->skip($offset)->take($limit)->pluck($attribute)->sum();
}
}
<?php

namespace App\Tables\Components\Columns\Summarizers;

use Exception;
use Filament\Tables\Columns\Summarizers\Summarizer;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\Schema;

class SumAttribute extends Summarizer
{
protected function setUp(): void
{
parent::setUp();

$this->numeric();
}

/**
* @return int | float | array<string, array<string, int>> | null
*/
public function summarize(Builder $query, string $attribute): int | float | array | null
{
$column = $this->getColumn();
$isField = Schema::hasColumn($this->getQuery()->getModel(), $column->getName());

if ($isField) {
throw new Exception("The [{$column->getName()}] column must be an Attribute.");
}

$limit = $this->getQuery()->getQuery()->limit;
$offset = $this->getQuery()->getQuery()->offset;
return $this->getQuery()->getModel()->get()->skip($offset)->take($limit)->pluck($attribute)->sum();
}
}
9 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
summarize and custom model attribute
@qcol74 Here is the attribute which will do what you want.
9 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
summarize and custom model attribute
@qcol74 I think a custom version of sum is required. I'm going to try and write one and will let you know how I get on.
9 replies
FFilament
Created by qcol on 7/31/2023 in #❓┊help
summarize and custom model attribute
I am having the same issue.
9 replies
FFilament
Created by Ian Tasker on 8/2/2023 in #❓┊help
Get record in edit widget
I am trying to display the widgets inline with other sections
7 replies
FFilament
Created by Ian Tasker on 8/2/2023 in #❓┊help
Get record in edit widget
Thanks, I have added it but its null unless the widget is in the header or footer.
7 replies
FFilament
Created by Ian Tasker on 8/1/2023 in #❓┊help
TextInputColumn size
That worked. Just seems odd to have such a big difference between TextColumn and TextInputColumn for options
7 replies
FFilament
Created by Ian Tasker on 7/31/2023 in #❓┊help
Non Tabbed Relation Managers
I have found this solution, i need to wrap the relation managers in a group with no name.
RelationGroup::make('', [ ... ]);
RelationGroup::make('', [ ... ]);
12 replies
FFilament
Created by Ian Tasker on 7/31/2023 in #❓┊help
Non Tabbed Relation Managers
Correct
12 replies
FFilament
Created by Ian Tasker on 7/31/2023 in #❓┊help
Non Tabbed Relation Managers
I thought true would display both inline
12 replies
FFilament
Created by Ian Tasker on 7/31/2023 in #❓┊help
Non Tabbed Relation Managers
12 replies
FFilament
Created by Ian Tasker on 7/31/2023 in #❓┊help
Non Tabbed Relation Managers
12 replies