outl1ne / nova-notes-field

This Laravel Nova package adds a notes field to Nova's arsenal of fields.
MIT License
51 stars 36 forks source link

Using get_avatar_url in config #21

Closed LorenzoSapora closed 4 years ago

LorenzoSapora commented 4 years ago

I am attempting to use the spatie medialibrary callable, but failing. What am I doing wrong?

// config/nova-notes-field.php

return [
    'get_avatar_url' => auth()->user()->getFirstMediaUrl('avatar')
];
Tarpsvo commented 4 years ago

That's not a callable. Try this:

return [
    'get_avatar_url' => fn ($user) => $user->getFirstMediaUrl('avatar'),
];
LorenzoSapora commented 4 years ago

Ack. I can't believe I missed that. Thanks