Only use laravel newsletter for subscriptions when the MAILCHIMP variables are filled out

This commit is contained in:
Kevin MacMartin 2017-09-26 15:03:23 -04:00
parent 12cbe5c404
commit e89191027b

View file

@ -20,12 +20,14 @@ class SubscriptionController extends Controller {
$email = $request['email']; $email = $request['email'];
$address = $request['address']; $address = $request['address'];
// Submit the subscription request if (env('MAILCHIMP_APIKEY', '') != '' && env('MAILCHIMP_LISTID', '') != '') {
Newsletter::subscribe($email, [ // Submit the subscription request
'FNAME' => $fname, Newsletter::subscribe($email, [
'LNAME' => $lname, 'FNAME' => $fname,
'ADDRESS' => $address 'LNAME' => $lname,
]); 'ADDRESS' => $address
]);
}
// Save to the database on success // Save to the database on success
$subscriptions = new Subscriptions; $subscriptions = new Subscriptions;