# Fill a Vue select from a PHP enum

> Send enum cases as value and label props. Validate the posted string with Rule::enum.

- URL: https://laravel-vuejs.space/php-enum-select-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, PHP

People searching “PHP enum select Vue” dump `PostStatus::cases()` into Inertia and then the select posts the wrong string. A backed enum has a `value` and a `name`. Store the value.

> **TL;DR**
>
> -   Send enum cases as value and label props.
> -   Validate the posted string with Rule::enum.
> -   Do not pass `PostStatus::cases()` straight through.
> -   Do not validate with `in:Draft,Published` if the column stores `draft` and `published`.
>
> **Who it's for:** Laravel + Vue developers
>
> **Applies to:** Laravel 13 · Vue 3

## The fix

```php
enum PostStatus: string
{
    case Draft = 'draft';
    case Published = 'published';
}
```

```php
use Illuminate\Validation\Rule;

return Inertia::render('posts/Create', [
    'statuses' => array_map(
        fn (PostStatus $status) => ['value' => $status->value, 'label' => $status->name],
        PostStatus::cases(),
    ),
]);
```

```vue
<select v-model="form.status" name="status">
  <option v-for="status in statuses" :key="status.value" :value="status.value">
    {{ status.label }}
  </option>
</select>
```

```php
'status' => ['required', Rule::enum(PostStatus::class)],
```

## What to avoid

> **Gotcha**
>
> Do not pass `PostStatus::cases()` straight through. The page then has to know PHP’s enum JSON shape. Do not validate with `in:Draft,Published` if the column stores `draft` and `published`.

## FAQ

**Q: How do I fill a Vue select from a PHP enum?**

Send enum cases as value and label props. Validate the posted string with Rule::enum.

**Q: What goes wrong with PHP enum select Vue?**

Many developers dump `PostStatus::cases()` into Inertia and then the select posts the wrong string. Do not pass `PostStatus::cases()` straight through.
