Loach's avatar
Level 11

File Uploads in Nova

I am doing the following when creating my users. I it possible to put this code in the Nova dashboard so it does the same when creating a user. I looked through documentation but was unclear.

I have not bought Nova yet, but if this is possible then I will be purchasing.

  $photo = Image::make($request->file('file'))
                ->resize(200, null, function ($constraint) { $constraint->aspectRatio(); } )
                ->encode('jpg',80);
            $randomPath = $user->id.'/profile/'. uniqid('',true) . '.jpg';

            Storage::disk(config('filesystems.default'))->put( $randomPath, $photo);
            $user->avatar = $randomPath;

0 likes
5 replies
Loach's avatar
Level 11

@jlrdw It is obvious I know how to store files. How to do the above IN NOVA is what I am concerned with.

Loach's avatar
Level 11

If I understand what you are saying just keep my controller in the laravel code the same, and just use the file input field within nova? Nova just calls the controller code then?

Please or to participate in this conversation.