Arko
Arko
FFilament
Created by Arko on 11/3/2023 in #❓┊help
$columnSpan on StatOverviewWidget
I'm trying to get 4 stats per row, but changing the $columnSpan doesn't seem to do anything. For example:
class KpiStats extends StatsOverviewWidget
{
protected int | string | array $columnSpan = 1;

protected function getStats(): array
{
return [
Stat::make(__('Stat 1'),'€0,00'),
Stat::make(__('Stat 2'),'€0,00'),
Stat::make(__('Stat 3'),'€0,00'),
Stat::make(__('Stat 4'),'€0,00'),
Stat::make(__('Stat 5'),'€0,00'),
Stat::make(__('Stat 6'),'€0,00'),
Stat::make(__('Stat 7'),'€0,00'),
Stat::make(__('Stat 8'),'€0,00'),
];
}
}
class KpiStats extends StatsOverviewWidget
{
protected int | string | array $columnSpan = 1;

protected function getStats(): array
{
return [
Stat::make(__('Stat 1'),'€0,00'),
Stat::make(__('Stat 2'),'€0,00'),
Stat::make(__('Stat 3'),'€0,00'),
Stat::make(__('Stat 4'),'€0,00'),
Stat::make(__('Stat 5'),'€0,00'),
Stat::make(__('Stat 6'),'€0,00'),
Stat::make(__('Stat 7'),'€0,00'),
Stat::make(__('Stat 8'),'€0,00'),
];
}
}
39 replies
FFilament
Created by Arko on 10/22/2023 in #❓┊help
Importing a js lib via Async Alpine
I'm loading an Alpine component asynchronously, however now my lib import doesn't work anymore:
import Tribute from "tributejs";
import Tribute from "tributejs";
Gives me this error:
Uncaught (in promise) TypeError: Failed to resolve module specifier "tributejs". Relative references must start with either "/", "./", or "../".
Uncaught (in promise) TypeError: Failed to resolve module specifier "tributejs". Relative references must start with either "/", "./", or "../".
Now tossing in the full relative path import Tribute from "../../../../node_modules/tributejs/dist/tribute.esm.js"; also doesn't work since its loaded via http, so it'd try to load this: https://my-app.test/node_modules/tributejs/dist/tribute.esm.js which obviously wouldnt work. Do I need to somehow compile this tributejs into public for this to work with async alpine?
2 replies
FFilament
Created by Arko on 10/19/2023 in #❓┊help
RichEditor link in new tab
Any way to have links made with the RichEditor open in a new tab?
7 replies
FFilament
Created by Arko on 10/15/2023 in #❓┊help
Sending data to a modal through `$this->dispatch()`
I am trying to dispatch some data from a Livewire component via $this->dispatch(). How can I access this data in my modal?
public function useTemplate($templateId): void
{
$this->dispatch(
event: 'open-modal',
id: 'use-template-modal',
data: [
'template_id' => $templateId,
],
);
}
public function useTemplate($templateId): void
{
$this->dispatch(
event: 'open-modal',
id: 'use-template-modal',
data: [
'template_id' => $templateId,
],
);
}
2 replies
FFilament
Created by Arko on 10/14/2023 in #❓┊help
Validate current password
I'm creating a password update field, where I ask for the users current password and then for the new one with confirmation. Is there any built-in method to validate their current password against the database?
5 replies
FFilament
Created by Arko on 9/27/2023 in #❓┊help
Conditionally show a dashboard page
return $panel
->pages([
Pages\Dashboard::class,
]);
return $panel
->pages([
Pages\Dashboard::class,
]);
I only want to have certain user roles have a dashboard, but the user is not resolved yet in the panel's provider. Is there any way to just hide a dashboard via policies for example, just like how I can hide a resource for certain users?
18 replies
FFilament
Created by Arko on 9/27/2023 in #❓┊help
TextInputColumn $get
I'm creating a table that allows inline editing using TextInputColumn'. I would like to get a previous fields value in order to do some db updating:
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectCostDay $model) use ($date) {
ray($get($date . '_revenue'));

return $state;
}),
TextInputColumn::make($date . '_revenue')
->label('Aantal')
->placeholder('0'),
TextInputColumn::make($date)
->placeholder('0.00')
->updateStateUsing(function ($state, Get $get, ProjectCostDay $model) use ($date) {
ray($get($date . '_revenue'));

return $state;
}),
I'm probably misusing $get here, but I can't wrap my head around it.
10 replies
FFilament
Created by Arko on 8/23/2023 in #❓┊help
Default option with `->getSearchResultsUsing`
I've got a select like this:
Forms\Components\Select::make('project_id')
->label('Project')
->preload()
->searchable()
->getSearchResultsUsing(fn(string $searchQuery) => \App\Models\Project::query()
->where('name', 'like', "%{$searchQuery}%")
->pluck('name', 'id')
->toArray())
->getOptionLabelUsing(fn($project) => $project->name)
Forms\Components\Select::make('project_id')
->label('Project')
->preload()
->searchable()
->getSearchResultsUsing(fn(string $searchQuery) => \App\Models\Project::query()
->where('name', 'like', "%{$searchQuery}%")
->pluck('name', 'id')
->toArray())
->getOptionLabelUsing(fn($project) => $project->name)
But would like to preselect a project if its available in the route parameter, how can I do that? Tried adding ->default(1) (1 is a project ID) but that throws An attempt was made to evaluate a closure for [Filament\Forms\Components\Select], but [$project] was unresolvable. Also the ->preload() doesn't seem to do anything.
8 replies