Back to School: coupon SCHOOL25 for 40% off Yearly/Lifetime membership! Read more here

Repeater: Choose Tournament Winners

Filament 4
Also available in Filament 3 version

This project illustrates the Filament Repeater field with positional element management. When selecting the top 3 tournament winner countries, each chosen country automatically becomes unavailable in the remaining dropdown selections to prevent duplicates.

VJF6mXKDREdAtP0BIp4S80a86UUyk7-metaNC1yZXBlYXRlci10b3VybmFtZW50LXdpbm5lcnMucG5n-

Get the Source Code:

How it works

The whole logic of this live-updated form is in the Filament Resource file, in its form() method.

  • We're using Repeater::make() with ->defaultItems(3)->addable(false)->deletable(false) to have strictly 3 items.
  • We load the options for the repeater Select from the Relationship of Tournament model, from method country()
  • In the Select, we use the ->live()->disableOptionWhen() method and the $get variable inside to define which options should be disabled
  • We use ->afterStateHydrated() in repeater to transform the results into the format we actually need to save to the DB.

The full code of that method:

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 151 Premium Examples for $99