Dependency Injection on Custom Fields

Hello,

I have a custom field that I've created which has a few getter/setter functions - one of which is called mergeTags().

When calling this function from my form ie:

CustomFieldName::make('custom_field)
->mergeTags(....)

I would like to dependancy inject the record I am currently editing, the same way you can do with default etc:

->default(function (Model $record) {
return $record->....;
}),

Any ideas how this can be accomplished?

Currently I get 'Too few arguments to function...' error
Thanks!
Was this page helpful?