Update laravel newsletter

This commit is contained in:
Kevin MacMartin 2017-09-26 15:59:57 -04:00
parent 956b4fe51e
commit 0c2d78fae1
5 changed files with 83 additions and 94 deletions

View file

@ -20,10 +20,14 @@ class SubscriptionController extends Controller {
if (env('MAILCHIMP_APIKEY', '') != '' && env('MAILCHIMP_LISTID', '') != '') {
// Submit the subscription request
Newsletter::subscribe($email, [
Newsletter::subscribeOrUpdate($email, [
'FNAME' => $fname,
'LNAME' => $lname
]);
if (!Newsletter::lastActionSucceeded()) {
Log::info('Mail Chimp Error: ' . Newsletter::getLastError());
}
}
// Save to the database on success

View file

@ -11,7 +11,7 @@
"laravel/tinker": "~1.0",
"radic/blade-extensions": "~7.0",
"erusev/parsedown": "~1.5",
"spatie/laravel-newsletter": "^2.2",
"spatie/laravel-newsletter": "^4.1.0",
"intervention/image": "^2.3",
"maatwebsite/excel": "^2.1"
},

124
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "b5435eac5e75f253aa1f2b46eac0aeff",
"content-hash": "60cb805d7576ef65e691b39fe8d902f3",
"packages": [
{
"name": "anahkiasen/underscore-php",
@ -328,6 +328,49 @@
],
"time": "2014-09-09T13:34:57+00:00"
},
{
"name": "drewm/mailchimp-api",
"version": "v2.4",
"source": {
"type": "git",
"url": "https://github.com/drewm/mailchimp-api.git",
"reference": "fe480bb652f85270227bf6d639b0026a531f21fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/drewm/mailchimp-api/zipball/fe480bb652f85270227bf6d639b0026a531f21fc",
"reference": "fe480bb652f85270227bf6d639b0026a531f21fc",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
"vlucas/phpdotenv": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"DrewM\\MailChimp\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Drew McLellan",
"email": "drew.mclellan@gmail.com",
"homepage": "http://allinthehead.com/"
}
],
"description": "Super-simple, minimum abstraction MailChimp API v3 wrapper",
"homepage": "https://github.com/drewm/mailchimp-api",
"time": "2017-02-16T13:24:20+00:00"
},
{
"name": "egulias/email-validator",
"version": "2.1.2",
@ -1234,52 +1277,6 @@
],
"time": "2017-09-19T19:36:48+00:00"
},
{
"name": "mailchimp/mailchimp",
"version": "2.0.6",
"source": {
"type": "git",
"url": "https://bitbucket.org/mailchimp/mailchimp-api-php.git",
"reference": "7ac99b5ac746d5875c5c350ad7e3b83674c83ec1"
},
"dist": {
"type": "zip",
"url": "https://bitbucket.org/mailchimp/mailchimp-api-php/get/7ac99b5ac746d5875c5c350ad7e3b83674c83ec1.zip",
"reference": "7ac99b5ac746d5875c5c350ad7e3b83674c83ec1",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"apigen/apigen": "dev-master"
},
"type": "library",
"autoload": {
"psr-0": {
"Mailchimp": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "MailChimp Devs",
"email": "api@mailchimp.com",
"homepage": "http://mailchimp.com",
"role": "Developer"
}
],
"description": "API client library for the MailChimp bulk email as a service platform",
"homepage": "https://bitbucket.org/mailchimp/mailchimp-api-php",
"keywords": [
"api",
"email"
],
"time": "2014-10-30T20:38:12+00:00"
},
{
"name": "monolog/monolog",
"version": "1.23.0",
@ -2086,29 +2083,38 @@
},
{
"name": "spatie/laravel-newsletter",
"version": "2.2.0",
"version": "4.1.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-newsletter.git",
"reference": "cdfe4de92f4c822904bfaee5f85a98d495ca56d3"
"reference": "7a2b547a468babec0c0aa913052902b6e8a0f1ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-newsletter/zipball/cdfe4de92f4c822904bfaee5f85a98d495ca56d3",
"reference": "cdfe4de92f4c822904bfaee5f85a98d495ca56d3",
"url": "https://api.github.com/repos/spatie/laravel-newsletter/zipball/7a2b547a468babec0c0aa913052902b6e8a0f1ea",
"reference": "7a2b547a468babec0c0aa913052902b6e8a0f1ea",
"shasum": ""
},
"require": {
"illuminate/support": "~5.0",
"mailchimp/mailchimp": "~2.0",
"php": ">=5.4.0"
"drewm/mailchimp-api": "^2.4",
"illuminate/support": "~5.5.0",
"php": "~7.0"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "4.*",
"scrutinizer/ocular": "~1.1"
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^6.3"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Newsletter\\NewsletterServiceProvider"
],
"aliases": {
"Newsletter": "Spatie\\Newsletter\\NewsletterFacade"
}
}
},
"autoload": {
"psr-4": {
"Spatie\\Newsletter\\": "src"
@ -2126,14 +2132,14 @@
"role": "Developer"
}
],
"description": "Manage newsletters in Laravel 5",
"description": "Manage newsletters in Laravel",
"homepage": "https://github.com/spatie/laravel-newsletter",
"keywords": [
"laravel",
"mailchimp",
"newsletter"
],
"time": "2015-12-21T22:48:10+00:00"
"time": "2017-08-30T23:11:15+00:00"
},
{
"name": "swiftmailer/swiftmailer",

View file

@ -236,7 +236,6 @@ return [
/*
* Custom Class Aliases...
*/
'Newsletter' => Spatie\Newsletter\NewsletterFacade::class,
'Image' => Intervention\Image\Facades\Image::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Language' => App\Utilities\Language::class,

View file

@ -2,14 +2,17 @@
return [
'mailChimp' => [
/*
* The api key of a MailChimp account. You can find yours here:
* https://us10.admin.mailchimp.com/account/api-key-popup/
*/
'apiKey' => env('MAILCHIMP_APIKEY'),
/*
* When not specifying a listname in the various methods, use the list with this name
*/
'defaultListName' => 'subscribers',
/*
* Here you can define properties of the lists you want to
* send campaigns.
@ -31,34 +34,11 @@ return [
* http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id
*/
'id' => env('MAILCHIMP_LISTID'),
/*
* These values will be used when creating a new campaign.
*/
'createCampaign' => [
'fromEmail' => '',
'fromName' => '',
'toName' => '',
],
],
/*
* These values will be used when subscribing to a list.
* If you're having trouble with https connections, set this to false.
*/
'subscribe' => [
'emailType' => 'html',
'requireDoubleOptin' => false,
'updateExistingUser' => false,
],
/*
* These values will be used when unsubscribing from a list.
*/
'unsubscribe' => [
'deletePermanently' => false,
'sendGoodbyeEmail' => false,
'sendUnsubscribeEmail' => false,
],
],
],
],
'ssl' => true,
];