orchidsoftware / orchidsoftware/platform
Relation field empty option
Open
@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:
But there a way to clear simple select since it has empty option:
And also I think that adding method empty instead of allowEmpty to Relation will be more consistent and convenient.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.