ToonVD
ToonVD
FFilament
Created by ToonVD on 5/27/2024 in #❓┊help
Dynamically redirecting homepage
Hi I fixed this through a webroute on '/' and a controller that redirects in __invoke. This is way better I guess.
2 replies
FFilament
Created by ToonVD on 5/24/2024 in #❓┊help
Filter resource data with url
Yup, this fixes it! Thanks!
5 replies
FFilament
Created by ToonVD on 5/24/2024 in #❓┊help
Filter resource data with url
Will try, thanks!
5 replies
FFilament
Created by ToonVD on 4/25/2024 in #❓┊help
Loading a table widget on (form) select change.
Late reply, I missed this xD
8 replies
FFilament
Created by ToonVD on 4/25/2024 in #❓┊help
Loading a table widget on (form) select change.
canView is static
8 replies
FFilament
Created by ToonVD on 4/25/2024 in #❓┊help
Loading a table widget on (form) select change.
I have a feeling I am making it too complex but having a hard time in getting what I need in canView. So I created my own template. If anyone has any ideas for improvement, much appreciated!
8 replies
FFilament
Created by ToonVD on 4/25/2024 in #❓┊help
Loading a table widget on (form) select change.
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))
]);
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')
];
}

<?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>
<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>
8 replies
FFilament
Created by ToonVD on 4/25/2024 in #❓┊help
Loading a table widget on (form) select change.
Thanks for the idea, will look into it and come back here.
8 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
Did you manage to reproduce?
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
In PM
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
You want both the resource and the page itself? I can send a Git diff
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
<?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)
{
}
}
<?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)
{
}
}
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
The one that fixed it? Yes, hold on
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
Yes, this was a custom page, sorry for the late reply.
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
The error was a bit vague though. Took a bit of debugging 🙂
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
So, turns out I forgot to declare the global resource var on one of my pages. In Filament 2, this didn't cause issues, in 3 it did.
class MyPage extends Page
{
public function mount($page_id)
class MyPage extends Page
{
public function mount($page_id)
to
class MyPage extends Page
{
protected static string $resource = MyPageResource::class;

public function mount($page_id)
class MyPage extends Page
{
protected static string $resource = MyPageResource::class;

public function mount($page_id)
17 replies
FFilament
Created by ToonVD on 11/8/2023 in #❓┊help
Stuck on upgrade
No, it's on post autoload command and basically everywhere. I will check.
17 replies