phplaravelnewsletter

subscribePending method is not available in (laravel-newsletter) newer version(5.1)


got to know that Newsletter::subscribePending() is not present in current version(5.1) of package. How to avail this method or can anybody recommend the alternative package for it which provide both subscribe as well as subscribePending methods?

Package link : laravel-newsletter package

Thank you.

use Newsletter;

Newsletter::subscribe($email, ['FNAME' => $fname, 'LNAME' => $lname]);

but there is no method to add user as a subscriber with pending status, which user can confirm to subscribe the news letter. i want to available below method -

Newsletter::subscribePending($email, ['FNAME' => $fname, 'LNAME' => $lname]);

but subscribePending is not available in v5.1. how to avail it?


Solution

  • If you take a look at the code of the package, specifically here MailChimpDriver you can see that the only thing that subscribePending() does is add ['status' => 'pending'] to the options array. So you can basically just bypass the method if you change your code to

    Newsletter::subscribe($email, [
       'FNAME' => $fname, 
       'LNAME' => $lname, 
       'status' => 'pending'
    ]);