Frans
Frans
FFilament
Created by Frans on 7/30/2024 in #❓┊help
Override creation in Importer
My Client model does not have a foo column, however, my import file does and for some reason, it must not be removed because it will be saved in another table. I am using the built-in importer. Is there any workaround to adjust the creation attributes? Or should I go test other import packages such as the handleRecordCreation() of konnco/filament-import? I tried doing it in resolveRecord() but id throws an error 'Column not found foo'
public static function getColumns(): array
{
return [
Import::Column::make('name'),
Import::Column::make('contact'),
Import::Column::make('foo'),
]
}
public static function getColumns(): array
{
return [
Import::Column::make('name'),
Import::Column::make('contact'),
Import::Column::make('foo'),
]
}
public function resolveRecord(): ?Client
{
return new Client([
'name' => $this->data['contact'],
'contact' => $this->data['contact'],
]);
}
public function resolveRecord(): ?Client
{
return new Client([
'name' => $this->data['contact'],
'contact' => $this->data['contact'],
]);
}
public function afterSave(): void
{
Bar::create(['x' => $this->data['foo']);
}
public function afterSave(): void
{
Bar::create(['x' => $this->data['foo']);
}
1 replies
FFilament
Created by Frans on 6/4/2024 in #❓┊help
Add a table in a custom filament page using table builder
Good day! I am new to filament and I want to display a table in a custom filament page using the table builder. However I am getting an error: Argument #1 ($table) must be of type Filament\Tables\Table, Filament\Infolists\Infolist given, called vendor\filament\infolists\src\Concerns\InteractsWithInfolists.php Custom Page:
namespace App\Filament\Pages;

use Filament\Pages\Page;
use Filament\Tables\Table;
use App\Models\MalasakitSummary;
use Filament\Tables\Columns\TextColumn;

class MalasakitDashboard extends Page
{
protected static string $view = 'filament.pages.malasakit-dashboard';

protected static ?string $title = 'Malasakit Dashboard';
protected static ?string $navigationLabel = 'Dashboard';
protected static ?string $slug = 'malasakit-centers/dashboard';
protected ?string $heading = 'Malaskit Dashboard';
protected static ?string $navigationGroup = 'Malasakit';

public static function table(Table $table): Table
{
return $table
->query(MalasakitSummary::query())
->columns([
TextColumn::make('name')
->label('Name'),
]);
}
}
namespace App\Filament\Pages;

use Filament\Pages\Page;
use Filament\Tables\Table;
use App\Models\MalasakitSummary;
use Filament\Tables\Columns\TextColumn;

class MalasakitDashboard extends Page
{
protected static string $view = 'filament.pages.malasakit-dashboard';

protected static ?string $title = 'Malasakit Dashboard';
protected static ?string $navigationLabel = 'Dashboard';
protected static ?string $slug = 'malasakit-centers/dashboard';
protected ?string $heading = 'Malaskit Dashboard';
protected static ?string $navigationGroup = 'Malasakit';

public static function table(Table $table): Table
{
return $table
->query(MalasakitSummary::query())
->columns([
TextColumn::make('name')
->label('Name'),
]);
}
}
View:
<x-filament-panels::page>
{{ $this->table }}
</x-filament-panels::page>
<x-filament-panels::page>
{{ $this->table }}
</x-filament-panels::page>
Should I use other ways to do this such as livewire component, table widget, or hard coding a table then pass the data? Thank you.
4 replies
FFilament
Created by Frans on 5/23/2024 in #❓┊help
Logs Plugin: Activity Log by Dennis Koch or Logger by ZedoX?
No description
4 replies