© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
ocram82

Widget table custom query

Hi all, i've a widget that aims to show the latest casting like this:


class LatestCastings extends BaseWidget
{
    protected static ?int $sort = 2;

    protected int|string|array $columnSpan = 'full';
    public function table(Table $table): Table
    {
        return $table
            ->heading('Recent Castings')
            ->query(
                Casting::query()->where('user_id', auth()->id())->latest()->take(5)
            )
            ->columns([
....
class LatestCastings extends BaseWidget
{
    protected static ?int $sort = 2;

    protected int|string|array $columnSpan = 'full';
    public function table(Table $table): Table
    {
        return $table
            ->heading('Recent Castings')
            ->query(
                Casting::query()->where('user_id', auth()->id())->latest()->take(5)
            )
            ->columns([
....


but
Casting::query()->where('user_id', auth()->id())->latest()->take(5)
Casting::query()->where('user_id', auth()->id())->latest()->take(5)
seems not work
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom Table Widget
FilamentFFilament / ❓┊help
2y ago
Error table query for table widget
FilamentFFilament / ❓┊help
3y ago
Custom query table
FilamentFFilament / ❓┊help
3y ago
Table Widget - query with join
FilamentFFilament / ❓┊help
16mo ago