dacastro4 / laravel-gmail

Laravel wrapper for the Gmail API
MIT License
292 stars 134 forks source link

If messages are null in all() method error generated #244

Open NaagarjunaaRavikkumar opened 1 year ago

NaagarjunaaRavikkumar commented 1 year ago

Hi team, https://github.com/dacastro4/laravel-gmail/blob/master/src/Services/Message.php#:~:text=%24messages%20%3D%20%24response%2D%3EgetMessages()%3B

if the messages are null due to added filters then it is returning error. we need to add a check for messages. kindly check the image for error.

image

Thanks

joneriktalvio commented 1 year ago

Had the same issue, changed the code in Message.php like this:

if ( is_countable($messages) && count($messages) > 0){
    $mails = $this->batchRequest($messages);    
}else{
    $mails = [];
}