Filament::getTenant() has no such method

The getTenant method returns a generic type object which ofcourse doesn't have the same methods as my tenant model, is there any way to tell my IDE/PHPStan that those methods do exists?

Example:
$rule->where('household_id', Filament::getTenant()?->id);


Error that i get:
51 Access to an undefined property Illuminate\Database\Eloquent\Model::$id.
Solution
you gonna need something like this

/** @var Company $tenant */
$tenant = Filament::getTenant();

$rule->where('household_id', $tenant->id);
Was this page helpful?