Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closures for fromModel #2833

Open
misog opened this issue May 8, 2024 · 0 comments
Open

Closures for fromModel #2833

misog opened this issue May 8, 2024 · 0 comments
Assignees

Comments

@misog
Copy link

misog commented May 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants