Jonas
Jonas
FFilament
Created by razor on 11/18/2024 in #❓┊help
Wizard dont show fullscreen on desktop
If you are using the wizard within a form then check that columSpanFull() is enabled. But for actions/modal you should add the steps in the $action->steps([]) function
4 replies
FFilament
Created by Jonas on 10/9/2024 in #❓┊help
Duplicate navigationbadge query with multitenancy
No, haven't found a fix for it
5 replies
FFilament
Created by Jonas on 10/9/2024 in #❓┊help
Duplicate navigationbadge query with multitenancy
Hey, I'm using getNavigationFeature() in a FilamentPHP multitenancy app, like this:
public static function getNavigationBadge(): ?string
{
$waitingTasksCount = CustomerTask::waitingOnCustomer()->count();
return $waitingTasksCount > 0 ? (string) $waitingTasksCount : null;
}
public static function getNavigationBadge(): ?string
{
$waitingTasksCount = CustomerTask::waitingOnCustomer()->count();
return $waitingTasksCount > 0 ? (string) $waitingTasksCount : null;
}
While investigating with Laravel Debugbar, I noticed that the query runs for every tenant the user has access to, which seems unnecessary. For example, if I, as a user, have access to 10 customers, each page load runs 10 queries to get the navigation badge for each customer—even though only the active tenant is displayed and needed. I also noticed that it queries navigation badges for another panel on each page load, leading to even more unnecessary queries. Is there a way to ensure it only runs the query for the selected tenant and only within the same panel?
5 replies
FFilament
Created by Saeed on 8/31/2024 in #❓┊help
Hide clear icon on searchable select
->selectablePlaceholder(false) should do the trick
3 replies
FFilament
Created by Jonas on 2/17/2024 in #❓┊help
Using table builder with an external API
class MissingVoucherAPI extends Model
{
use \Sushi\Sushi;

protected int $teamID;
protected int $accountID;

protected array $schema = [
'id' => 'integer',
'date' => 'date',
'voucher_id' => 'integer',
'voucher_number' => 'string',
'description' => 'string',
'supplier' => 'string',
'customer_id' => 'integer',
];

protected function sushiShouldCache()
{
return false;
}

public function getRows(): array
{

$products = Http::get("https://dummyjson.com/products?team={$this->teamID}&{$this->accountID}")->json();


return [];
}

}
class MissingVoucherAPI extends Model
{
use \Sushi\Sushi;

protected int $teamID;
protected int $accountID;

protected array $schema = [
'id' => 'integer',
'date' => 'date',
'voucher_id' => 'integer',
'voucher_number' => 'string',
'description' => 'string',
'supplier' => 'string',
'customer_id' => 'integer',
];

protected function sushiShouldCache()
{
return false;
}

public function getRows(): array
{

$products = Http::get("https://dummyjson.com/products?team={$this->teamID}&{$this->accountID}")->json();


return [];
}

}
And where i will be calling it:
public function table(Table $table): Table
{


return $table
->query(MissingVoucherAPI::query() // ** HERE I ALSO NEED TO DEFINE teamID and accountID)
->emptyStateHeading('Ingen data')
->columns([
Tables\Columns\TextColumn::make('type')
->default('Mangler kvittering/kommentar'),
Tables\Columns\TextColumn::make('date'),
Tables\Columns\TextColumn::make('voucher_id'),
Tables\Columns\TextInputColumn::make('description'),
Tables\Columns\TextColumn::make('supplier'),
])
->bulkActions([
Tables\Actions\BulkAction::make('send_to_customer')
->requiresConfirmation()
->action(fn (Collection $records) => $records->each->sendToCustomer()),
]);
}
public function table(Table $table): Table
{


return $table
->query(MissingVoucherAPI::query() // ** HERE I ALSO NEED TO DEFINE teamID and accountID)
->emptyStateHeading('Ingen data')
->columns([
Tables\Columns\TextColumn::make('type')
->default('Mangler kvittering/kommentar'),
Tables\Columns\TextColumn::make('date'),
Tables\Columns\TextColumn::make('voucher_id'),
Tables\Columns\TextInputColumn::make('description'),
Tables\Columns\TextColumn::make('supplier'),
])
->bulkActions([
Tables\Actions\BulkAction::make('send_to_customer')
->requiresConfirmation()
->action(fn (Collection $records) => $records->each->sendToCustomer()),
]);
}
3 replies
FFilament
Created by bearer on 2/14/2024 in #❓┊help
Add Edit action on View page
No description
4 replies