__invoke
return $form ->schema([ Forms\Components\Select::make('scoped') ->label('Is scoped') ->options([1 => 'Ja', 0 => 'Nee']) ->reactive() ->afterStateUpdated(fn ($state, $livewire) => $livewire->dispatch('toggleTableWidget', $state)) ]);
<?php namespace App\Filament\Resources\UserResource\Widgets; use Filament\Tables\Columns\TextColumn; use Filament\Widgets\TableWidget as BaseWidget; use Illuminate\Database\Eloquent\Builder; use App\Models\Account; use Illuminate\Database\Eloquent\Model; class UserAccounts extends BaseWidget { public ?Model $record = null; public bool $showTableWidget; protected static string $view = 'toon.widgets.table-widget'; protected $listeners = ['toggleTableWidget']; public function toggleTableWidget($showTableWidget) { $this->showTableWidget = $showTableWidget; } protected function getTableQuery(): Builder { return Account::where('user_id', '=', $this->record->client_id); } protected function getTableColumns(): array { return [ TextColumn::make('id'), TextColumn::make('name'), TextColumn::make('description') ]; }
<x-filament-widgets::widget class="fi-wi-table"> @if($showTableWidget) {{ \Filament\Support\Facades\FilamentView::renderHook('widgets::table-widget.start', scopes: static::class) }} {{ $this->table }} {{ \Filament\Support\Facades\FilamentView::renderHook('widgets::table-widget.end', scopes: static::class) }} @endif </x-filament-widgets::widget>
<?php namespace App\Filament\Resources\MyResource\Pages; use App\Filament\Resources\MyResource; use Filament\Resources\Pages\Page; class MyPage extends Page { protected static string $resource = MyResource::class; public function mount($resource_id) { } }
class MyPage extends Page { public function mount($page_id)
class MyPage extends Page { protected static string $resource = MyPageResource::class; public function mount($page_id)