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([
....


but Casting::query()->where('user_id', auth()->id())->latest()->take(5) seems not work
Was this page helpful?