4unkur's avatar

LARAVEL NOVA: File field is empty on edit page

Avatar::make('Avatar')->store(function ($request) {
    return [
        'avatar' => basename($request->avatar->store('public/users'))
    ];
})->displayUsing(function ($value) {
    return 'users/' . $value;
})->prunable(),

I have this field in User resource. Everything works fine except edit page: it says that no file is uploaded even if it is.

https://imgur.com/a/WPPV3yC

What am I missing?

0 likes
4 replies
zion's avatar

That's because you cannot do what you expect to happen, at least as far as I know. Looking at your code you're working with avatars. Something most apps do is just show the image if there is one uploaded for the user (with tags).

zion's avatar

I did not pay attention to the nova tag, my apologies. I have indeed not yet worked with nova.

1 like
4unkur's avatar

@ZION - That's OK man, It happened twice ) In the other thread I have created there were also some generic answers, not related to Laravel Nova ) So I updated the title not to confuse people. Thanks anyway (:

Please or to participate in this conversation.