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'];
$address = $request['address'];
// Submit the subscription request
Newsletter::subscribe($email, [
'FNAME' => $fname,
'LNAME' => $lname,
'ADDRESS' => $address
]);
if (env('MAILCHIMP_APIKEY', '') != '' && env('MAILCHIMP_LISTID', '') != '') {
// Submit the subscription request
Newsletter::subscribe($email, [
'FNAME' => $fname,
'LNAME' => $lname,
'ADDRESS' => $address
]);
}
// Save to the database on success
$subscriptions = new Subscriptions;