platform icon indicating copy to clipboard operation
platform copied to clipboard

Closures for fromModel

Open misog opened this issue 9 months ago • 0 comments

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.

misog avatar May 08 '24 13:05 misog