orchidsoftware / orchidsoftware/platform

Relation field empty option

Open
#3,054 0 comments 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Oct 30, 2025.

Errors
Dominant language
PHP
Stars
4.8k
Forks
662
Avg merge
1d 9h
Merged PRs (30d)
7

Description

It seems to be impossible to make Relation field nullable (not non-required). If I selected value in it once, there is no way to clear it, even if field not required.

Reproducing:

Relation::make('post.user')
    ->fromModel(User::class, 'name')
    ->title('User')
    ->allowEmpty() // does nothing
    ->empty('-'),  // not works at all, because there is no such method in Relation class

Select::make('post.user')
    ->fromModel(User::class, 'name')
    ->title('User')
    ->empty('-'), // works perfectly

And there is no empty option or other way to clear it without page refreshing:

Image

But there a way to clear simple select since it has empty option:

Image

And also I think that adding method empty instead of allowEmpty to Relation will be more consistent and convenient.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.