Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Toughoj's avatar

Uploaded image issue in action

I have a Nova action in the user index page which is used to send a notification to users .The action has multiple fields including an Image field , when the action is executed on a single user or few users it works smoothly , but when I select all users and run the action it results in the following error :

Call to a member function store() on string

the action is as following :

public function handle(ActionFields $notification, Collection $users)
   	 {
       		 if ($notification->image) {
           	 	$image = Media::create([
           	     		'path' => $notification->image->store('media-directoy')
            		]);
            		$notification->image = $image->url;
      	 	 }


     	   	foreach ($users as $user) {
     	       		$user->notify(new notificationClass($notification));
       	 	}

        return Action::message(__('Notification Sent Successfully'));
    }
0 likes
0 replies

Please or to participate in this conversation.