Jun 16, 2020
0
Level 8
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'));
}
Please or to participate in this conversation.