Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here
Premium Members Only
Join to unlock this tutorial and all of our courses.
Tutorial Premium Tutorial

Filament Custom Page Example with Repeater: Pick Game Winners

June 15, 2023
7 min read

Filament is a great admin panel system, but it often confuses users how to create a custom non-CRUD page in Filament that wouldn't be a typical Resource? This tutorial will provide an example.


The Initial Task

In this tutorial, we will create a custom Filament page with just one form. We will use a Repeater field for selecting the winners for the game.

This tutorial has three Models:

  • Game
  • Player
  • User

This is what the DB schema looks like:

filament custom page DB schema

Our task is to build a custom page to pick the winner players for a particular game. So it's not a typical "Game Edit" page but something different.

It will be a Repeater with 10 dropdowns.

custom page result

Important: after selecting the player in one dropdown, it should automatically be removed from all the other dropdowns.


Setup Filament Resource

We will have only one Filament Resource for Games.

app/Filament/Resources/GameResource.php:

use App\Models\Game;
use Filament\Resources\Form;
use Filament\Resources\Table;
use Filament\Resources\Resource;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
 
class GameResource extends Resource
{
protected static ?string $model = Game::class;
 
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),
]);
}
 
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('name'),
]);
}
 
public static function getPages(): array
{
return [
'index' => Pages\ListGames::route('/'),
'create' => Pages\CreateGame::route('/create'),
'edit' => Pages\EditGame::route('/{record}/edit'),
];
}
}

Step 1. Empty Custom Page with a Link

So first, we need to create...

Premium Members Only

This advanced tutorial is available exclusively to Laravel Daily Premium members.

Premium membership includes:

Access to all premium tutorials
Video and Text Courses
Private Discord Channel

Comments & Discussion

M
magic-thomas ✓ Link copied!

prependActions not works, actions works for me.

N
Nerijus ✓ Link copied!

prependActions works. It means you are doing something wrong. At least post what error you

M
magic-thomas ✓ Link copied!

no errors.. it just does not display 'Pick winners' button.

M
magic-thomas ✓ Link copied!

I found why now.

I created Resource with '--generate' option.

It made 'actions' automatically.

After removing 'actions', 'prependActions' only worked.

SP
Steve Purcell ✓ Link copied!

prependActions is deprecated in Filament v3

N
Nerijus ✓ Link copied!

This tutorial was made when v3 wasn't launched.

KV
Kay Vin ✓ Link copied!

how to get the index of the current row inside a repeater ?

N
Nerijus ✓ Link copied!

Hope this helps https://github.com/filamentphp/filament/discussions/4002

MS
Muhammad Sidiq Ali ✓ Link copied!

Any idea how to auto fill repeater instead? If we want all user to get chance to be winner. Instead of selecting 1 by 1.

M
Modestas ✓ Link copied!

Sorry, what do you mean by this? You can set ->default() on your repeater field and it should load the entries. But besides that - I did not understand the question :)

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.