mardi 2 juillet 2019

How to delete image from project folder when image is in email content Laravel VueJs

I am sending email from my project using sendgrid or mailgun. And my email content is saving in my database table something like this.

<p>There are many variations of passages of Lorem Ipsum available.&nbsp;</p>
<figure class="image image-style-side"><img src="http://127.0.0.1:8000/email-content-files/1562132219.png"></figure>
<p>If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text..</p>

1562132219.png file is moved to public/email-content-files/. Now I want to delete the image file also when I will delete this email. How can I delete this image also from my project folder too. Would someone help me please! My delete method is bellow -

public function deleteSelectedRows($ids)
{
    $ids_in_arrays = explode( ',' , $ids );
    return EmailOutbox::whereIn('id', $ids_in_arrays)->delete();
}

Note: Inside content there may have multiple image like this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire