Hi everyone,
Is there a way to extend tailor models to have a custom method?
For example, a blueprint has firstName
and LastName
fields, and I want to add a method in the model class to return firstName
+ ’ ’ + ‘lastName’
I tried the following with no luck
EntryRecord::extendInSection('ACME\Customer', function($model) {
$model->bindEvent('model.extendBlueprint', function () use ($model) {
$model->fullname = $model->firstname . ' ' . $model->lastname;
});
});
Any ideas?
Thanks a lot,
Abbas