orchidsoftware / orchidsoftware/platform
Closures for fromModel
Open
@tabuna is already working on this.
Since May 8, 2024.
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 663
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 7
Description
Hi, consider this:
Relation::make('account')->fromModel(Account::class, 'first_name')->title('Account'),
I would like to do something like this:
Relation::make('account')->fromModel(Account::class, fn ($model) => $model->first_name . ' ' . $model->last_name)->title('Account'),
Or this:
Relation::make('account')->fromModel(Account::class, fn ($model) => $model->getFullName())->title('Account'),
I do not want to use model attributes.
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.