Text Version of the Lesson
In this lesson, let's review one of the most popular field types used in forms: dropdown selects. The data for the options may or may not come from another DB table as a relationship.

We will add two fields to our Products form:
- select to choose product status: "in stock", "sold out", "coming soon"
- select to choose product category: from another Category model
Simple Select Dropdown
Let's say that product may have one of the defined statuses, but we don't want to save them in a separate table.
Instead, let's make a PHP Enum class with values:
php artisan make:enum Enums/ProductStatusEnum --string
app/Enums/ProductStatusEnum.php:
namespace App\Enums; enum ProductStatusEnum: string{ case IN_STOCK = 'In Stock'; case SOLD_OUT = 'Sold Out'; case COMING_SOON = 'Coming Soon';}
Then, we will have a string field in the database with the default value from that Enum, in a new Migration:
Database Migration:
use App\Enums\ProductStatusEnum; // ... return new class extends Migration{ public function up(): void { Schema::table('products', function (Blueprint $table) { $table->string('status') ->default(ProductStatusEnum::IN_STOCK->value); }); }};
Let's make this field fillable in the Product Model.
app/Models/Product.php:
class Product extends Model{ use HasFactory; protected $fillable = ['name', 'price', 'status'];}
And then, we can show the value in the table, just as a simple column:
app/Filament/Resources/ProductResource.php:
return $table ->columns([ Tables\Columns\TextColumn::make('name') ->sortable(), Tables\Columns\TextColumn::make('price') ->sortable() ->money('usd') ->getStateUsing(function (Product $record): float { return $record->price / 100; }), Tables\Columns\TextColumn::make('status'), ])
In the form, we add that field as...
Hi great tutorial,
I am coming across an issue that I hope someone in the community could help with lets say for example I have the following
Users Organisations Teams
And I now want to create a User and I want to have a drop down of organisations I can pick, thats rather easy I can do that, however the issue im facing is lets say for example, there are specific Teams in a Organisation, how can I populate a drop down with those Teams and then multi select those teams.
I have created something like this
Which seems to work however on the edit if I select the dropdown again of oganisations I would get an error, Ive tried looking most places however as we know you are the man to come to :D
Thanks in advance to anyone that could assist
This question is quite specific and individual, so I can't answer without reproducing the project, playing around and debugging.
Have you tried to ask on the official Fliament discord?
If that didn't help, you could maybe invite me to your GitHub (username PovilasKorop) and I could try to play around, but my time is extremely limited if I want to put out the course soon.
You say that you get an error but you don't say what error. Error message might say a lot. But yes, as Povilas said, try asking in the official Filament discord server.