Skip to content

Instantly share code, notes, and snippets.

@goper-leo
Last active August 26, 2022 12:14
Show Gist options
  • Save goper-leo/64f62bd73a763927291f47349d57ebb5 to your computer and use it in GitHub Desktop.
Save goper-leo/64f62bd73a763927291f47349d57ebb5 to your computer and use it in GitHub Desktop.
Mailchimp Sample Code
<?php
namespace App\Helpers\Mailchimp;
use DrewM\MailChimp\MailChimp as MailchimpWrapper;
use DrewM\MailChimp\Batch;
use Carbon\Carbon;
use Log;
use File;
/**
* Helper class / methods for mailchimp request or transactions
*
* @author goper
*/
class Mailchimp
{
protected $mailchimp;
protected $templates_dir = 'Helpers/Mailchimp/Templates/';
protected $widgets_path;
protected $batch;
/**
* Create a new helper instance.
*
* @return void
*/
public function __construct()
{
$this->mailchimp = new MailchimpWrapper(env('MAILCHIMP_API_KEY'));
$this->mailchimp->verify_ssl = false;
$this->batch = $this->mailchimp->new_batch();
$this->widgets_path = $this->templates_dir . 'widgets/';
}
/**
* Get mailchimp error show alert message and log message for dev review
*
* @param object $response response of mailchimp after sending request
* @return void
*/
public function getMailchimpError($response)
{
if (!empty($response['errors'])) {
// Error on Mailchimp
// Log Errors
foreach ($response['errors'] as $err) {
Log::error('Field ' . $err['field'] . ' = ' . $err['message']);
return $this->jsonify(false, array_merge([
'message' => 'Mailchimp Error: Field ' . $err['field'] . ' - ' . $err['message'],
]));
}
}
}
/**
* Add list to mailchimp using POST mailchimp API
* Maybe use the form in `pages.email.list.widgets.list_form` for creating and using this helper
*
* @param $request - must be complete
* @return $list - mailchimp response to request used for getting the mailchimp_list_id
*/
public function addListToMailchimp($request)
{
$contact = [
'company' => $request->company,
'address1' => $request->address,
'city' => $request->city,
'state' => $request->state,
'zip' => $request->zip,
'country' => $request->country,
'phone' => $request->phone,
];
$campaign_details = [
'from_name' => $request->from_name,
'from_email' => $request->from_email,
'subject' => $request->reminder_text,
'language' => 'English',
];
$data = [
'name' => $request->name,
'contact' => $contact,
'permission_reminder' => $request->reminder_text,
'campaign_defaults' => $campaign_details,
'notify_on_subscribe' => !$request->send_one_by_one_subscribe ? '' : $request->from_email,
'notify_on_unsubscribe' => !$request->send_one_by_one_unsubscribe ? '' : $request->from_email,
'email_type_option' => false,
'visibility' => 'pub',
];
// Check id exist or not
if ($request->has('list_id')) {
// Update mailchimp list
$list = $this->mailchimp->patch('lists/' . $request->mailchimp_id, $data);
} else {
// Save List on Mailchimp API's
$list = $this->mailchimp->post('lists', $data);
}
if ($this->mailchimp->success()) {
return $list;
}
}
/**
* Create and get User campaign folder
* Check if user have a mailchimp campaign folder if `true` return folder_id
* If `false` then create a campaign folder on mailchimp
*
* @param $user_id
* @return string $folder_id - mailchimp campaign folder
* @todo See above method for instructions
*/
public function getCampaignFolder($user_id = null)
{
// Check User have a campaign_folder or not on Mailchimp
if (auth()->user()->mailchimp_campaign_folder == '') {
// Campaign folder not created yet - create new one
$user = auth()->user();
$name = $user->first_name . ' ' . $user->last_name;
$campaign_folder = $this->mailchimp->post('/campaign-folders', ['name' => $name]);
get_mailchimp_error($campaign_folder);
// Update user data add campaign_folder_id
$userModel = auth()->user();
$userModel->mailchimp_campaign_folder = $campaign_folder['id'];
$userModel->save();
$campaign_folder = $campaign_folder['id'];
} else {
// Get mailchimp_campaign_folder
$campaign_folder = auth()->user()->mailchimp_campaign_folder;
}
return $campaign_folder;
}
/**
* Post to mailchimp using their API add new camapaign of the user
*
* @param array $user_data [description]
* @return object $response - mailchimp response upon request
*/
public function postCampaignToMailchimp($campaign, $request)
{
$recipients = [
'list_id' => $campaign->list->mailchimp_id
];
$settings = [
'subject_line' => $campaign->subject_line,
'title' => $campaign->title,
'from_name' => $campaign->from_name,
'reply_to' => $campaign->reply_to,
'folder_id' => $campaign->mailchimp_campaign_folder,
];
$social_card = [
'image_url' => 'description', // Sample for now
'description' => $campaign->description,
'title' => $campaign->title,
];
$post_campaign = [
'type' => 'regular',
'recipients' => $recipients,
'settings' => $settings,
'social_card' => $social_card,
];
$create_campaign_mc = $this->mailchimp->post('/campaigns', $post_campaign);
if ($this->mailchimp->success()) {
return $create_campaign_mc;
} else {
return $this->mailchimp->getLastResponse();
}
}
/**
* Send via action for sending now or set schedule on mailchimp for the campaign
*
* @param [type] $mailchimp_campaign_id [description]
* @param [type] $reqeust [description]
* @return [type] [description]
*/
public function sendActionMailchimp($mailchimp_campaign_id, $request)
{
// After creating campaign set schedule for sending campaign or send it now
if ($request->custom_schedule) {
// Request wants to make a custom sending
// Combine custom schedule to date / time Y-m-d
$schedule_time = $request->schedule_date . ' ' . date("H:i", strtotime($request->schedule_time));
$schedule_data = [
'schedule_time' => Carbon::createFromFormat('Y-m-d H:i', $schedule_time)->toDateTimeString(),
'timewarp' => true
];
$schedule = $this->mailchimp->post('/campaigns' . '/' . $mailchimp_campaign_id . '/actions/schedule', $schedule_data);
if ($this->mailchimp->success()) {
return $schedule;
} else {
return $schedule;
}
} else {
// Send now
$send_now = $this->mailchimp->post('/campaigns' . '/' . $mailchimp_campaign_id . '/actions/send');
if ($this->mailchimp->success()) {
return $send_now;
} else {
return $send_now;
}
}
}
/**
* Get mailchimp templates using MC API
* @param $offset = offset of # to be search (skip)
* @return array - $templates
*/
public function getTemplates()
{
$templates = File::get(app_path($this->templates_dir . 'templates.json'));
return collect(json_decode($templates));
}
/**
* Get template data using template name get settings and frame of that template
* @param string $value [description]
* @return [type] [description]
*/
public function getTemplateData($template_name, $new_content = '')
{
$template_path = $this->templates_dir . $template_name . '/';
$settings = File::get(app_path($template_path . 'settings.json'));
$frame = File::get(app_path($template_path . 'frame.html'));
$form = collect(json_decode($settings));
$social_path = $this->widgets_path . 'icons/';
$social_src = File::get(app_path($social_path . 'source.json'));
$social_media_frame = File::get(app_path($social_path . 'social.html'));
$social_medias = collect(json_decode($social_src));
if ($new_content != '') {
$frame_sketch = $this->templateDecoder($frame, $form, $new_content);
} else {
$frame_sketch = $this->templateDecoder($frame, $form);
}
return compact('form', 'frame_sketch', 'social_medias', 'template_name', 'social_media_frame');
}
/**
* Encode new values first get the key on the settings create array and save it and partse
* the `value` variables and assign on each specific key. If values key is none then set to default value
*
* @param [type] $settings [description]
* @param [type] $values this is the new value if values are empty then set to default
* @return array $data the encoded values and settings new value of variables
*/
public function templateEncodeValues($values = '', $settings = '')
{
$new_values = [];
if ($values == '') {
// No values set content to default ones
foreach ($settings as $key => $setting) {
$new_values[$key] = $setting->default;
}
} else {
// New content values
// Match request to specific needed value on settings of template frame
$filtered_data = [];
foreach ($settings as $key => $settings) {
$filtered_data[$key] = $values[$key];
}
$new_values = $filtered_data;
}
return $new_values;
}
// Return frame
public function templateDecoder($frame, $settings = '', $value = '')
{
// Encode content values first
$template_encode_values = $this->templateEncodeValues($value, $settings);
// Decode!!
// Find on the frame the content that needs to be edited
$decoded_frame = $frame;
foreach ($template_encode_values as $key => $value) {
// Check key have image text or is an image add url_path for the full_url_on_mailchimp
if (strpos($key, 'image') !== false) {
$value = asset($value);
}
$decoded_frame = preg_replace("/{{(" . $key . ")}}/i", $value, $decoded_frame);
}
$data = [
'decoded_frame' => $decoded_frame,
'encoded_values' => $template_encode_values
];
return $data;
}
/**
* Helper method for requesting mailchimp
*
* @param [type] $path mailchimp path of the request
* @param string $method request method 'GET', `post` default value is `get`
* @param [type] $param added parameters for mailchimp needed data - default will be null
* @return array $mailchimp_response
*/
public function mailchimpRequest($path, $method = 'get', $param = null)
{
if ($param === null)
return $this->mailchimp->$method($path);
else
return $this->mailchimp->$method($path, $param);
}
/**
* Get settings file and back to controller to check values have changed or not
* @param [type] $template [description]
* @return [type] [description]
*/
public function getSettingsFile($template)
{
$template_path = $this->templates_dir . $template . '/';
$settings = File::get(app_path($template_path . 'settings.json'));
return collect(json_decode($settings));
}
/**
* Add template to mailchimp request
* @param string $value [description]
* @return [type] [description]
*/
public function postTemplateToMailchimp($name, $html, $mailchimp_id = '')
{
$data = [
'name' => $name,
'html' => $html
];
if ($mailchimp_id != '') {
// Update template
$response = $this->mailchimp->patch('templates/' . $mailchimp_id, $data);
} else {
// Create template
$response = $this->mailchimp->post('templates', $data);
}
if ($this->mailchimp->success()) {
return $response;
} else {
return $response;
}
}
/**
* Put content on campaign using maiclhimp API
* @param [type] $campaign_id [description]
* @param [type] $template_id [description]
*/
public function setCampaignContent($campaign_id, $template_id)
{
$data = [
'template' => ['id' => (int)$template_id]
];
$response = $this->mailchimp->put('campaigns/' . $campaign_id . '/content', $data);
if ($this->mailchimp->success()) {
return $response;
} else {
return $response;
}
}
/**
* Get average in percent
* @param [type] $divider the divisor or the items (active)
* @param [type] $dividend dividend this is the total # of items
* @param [type] $round round to nearest places default is null means round to whole number
* @return [type] [description]
*/
public function getAverage($divider, $dividend, $round = null)
{
return round(((float) $divider / (float) $dividend) * 100, $round);
}
/**
* Add subscriber on mailchimp using mailchimp API
* @param [type] $data [description]
*/
public function addSubscriberToMailchimp($mailchimp_list_id, $email, $first_name = '', $last_name = '', $hash = '')
{
$data = [
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => ['FNAME' => $first_name, 'LNAME' => $last_name],
];
if ($hash != '') {
// Update
$response = $this->mailchimp->patch('lists/' . $mailchimp_list_id . '/members' . '/' . $hash, $data);
} else {
// Create new
$response = $this->mailchimp->post('lists/' . $mailchimp_list_id . '/members', $data);
}
return $response;
}
/**
* Import / Add batch process subscribers on MailChimp
* @param [type] $lst_id mailchimp given id
* @param [type] $subscribers [description]
*/
public function addBatchSubscribers($list_id, $subscribers)
{
$count = 0;
foreach ($subscribers as $member) {
$additional_info = [
'FNAME' => array_key_exists('first_name', $member) ? $member['first_name'] : '',
'LNAME' => array_key_exists('last_name', $member) ? $member['last_name'] : '',
];
$subscriber = [
'email_type' => 'html',
'email_address' => $member['email'],
'language' => 'English',
'merge_fields' => $additional_info,
'status' => 'subscribed',
];
$this->batch->post('op' . $count, 'lists/' . $list_id . '/members', $subscriber);
++$count;
}
$result = $this->batch->execute();
$this->mailchimp->new_batch($result['id']);
return $this->batch->check_status();
}
/**
* Get mailchimp pricing data
*
* @return Collection
*/
public function getMailchimpPricingTable($emailCount = null)
{
$prices = config('services.mailchimp.pricing');
if (is_null($emailCount)) {
return collect($prices);
} else {
$data = [];
if ($emailCount > 0) {
// Get min - max (between) price and other info
foreach ($prices as $key => $price) {
$minRow = $price['min'];
$maxRow = $price['max'];
$total = $price['total'];
if ($emailCount < $maxRow && $emailCount > $minRow || $emailCount == $maxRow || $emailCount == $minRow) {
$data = ['price' => $price['price'], 'total' => number_format($total, 2)];
}
}
} else {
$data = ['price' => 0, 'total' => 0];
}
return collect($data);
}
}
/**
* Get Grow Promote list on Mailchimp search list on config file for faster query
* @return [type] [description]
*/
public function getGrowPromoteList()
{
$lists = config('services.mailchimp.lists');
$listWidPrice = [];
foreach ($lists as $key => $list) {
$price = $this->getMailchimpPricingTable($list['subscribers']);
$listWidPrice[] = [
'name' => $list['name'],
'id' => $list['id'],
'subscribers' => $list['subscribers'],
'price' => $price['price'],
'total' => $price['total'],
];
}
return collect($listWidPrice);
}
}
<?php
namespace App\Http\Controllers\Email;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DrewM\MailChimp\MailChimp;
// Modules
use App\Modules\Email\SubscriberModule;
// Requests
use App\Http\Requests\Email\CreateListRequest;
use App\Http\Requests\Email\AddSubscriberRequest;
use App\Http\Requests\Email\ImportSubscribersRequest;
class ListsController extends Controller
{
protected $emailList;
/**
* Module var
* @var [type]
*/
protected $subscriberModule;
/**
*
*
* @return void
*/
public function __construct(SubscriberModule $subscriberModule)
{
$this->subscriberModule = $subscriberModule;
}
/**
* Get the view of subscribers of a list this page also can add/export subscribers
* @param [type] $id [description]
* @return view
*/
public function subscribers($id = null)
{
return $this->subscriberModule->manage($id);
}
/**
* Post request for adding subscribers on emai list
*
*/
public function addSubscribers(AddSubscriberRequest $request)
{
return $this->subscriberModule->add($request);
}
/**
* Delete susbcriber
* @param Request $request post data
* @return [type] [description]
*/
public function deleteSubscribers(Request $request)
{
return $this->subscriberModule->delete($request);
}
/**
* Export list of subscribers into csv
* @param [type] $id list id
* @return [type] [description]
*/
public function exportSubscribers($id = null)
{
return $this->subscriberModule->export($id);
}
/**
* Read imported file
* @param ImportSubscribersRequest $request [description]
* @return [type] [description]
*/
public function readFile(ImportSubscribersRequest $request)
{
return $this->subscriberModule->readFile($request);
}
/**
* Save imported file on mailchimp and on database
* @param Request $request [description]
* @return [type] [description]
*/
public function saveImport(Request $request)
{
return $this->subscriberModule->save($request);
}
}
<?php
namespace App\Http\Requests\Email;
use App\Http\Requests\BaseRequest;
use Illuminate\Validation\Rule;
class CreateListRequest extends BaseRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'from_email' => 'required|email',
'from_name' => 'required|max:30',
'company' => 'required|max:50',
'address' => 'required',
'city' => 'required|max:40',
'state' => 'required|max:5',
'country' => 'required',
'zip' => 'required|max:10',
'reminder_text' => 'required|min:5',
'list_id' => 'sometimes|' . Rule::exists('email_lists', 'id')
];
}
/**
* Get custom error messages
* @return array custom error message
*/
public function messages()
{
return [
'from_email.required' => trans('cpanel.email.list.required.from_email'),
'name.required' => trans('cpanel.email.list.required.name'),
'from_name.required' => trans('cpanel.email.list.required.from_name'),
];
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EmailList extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'name',
'from_email',
'from_name',
'company',
'address',
'address_2',
'city',
'state',
'country',
'zip',
'phone',
'reminder_text',
'send_daily_summary',
'send_one_by_one_subscribe',
'send_one_by_one_unsubscribe',
'status',
'mailchimp_id',
];
/**
* Get user using list
*
* @return Relationship
* @author goper
*/
public function owner()
{
return $this->belongsTo('App\Models\User');
}
/**
* Scope a query to only include publish status.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeStatus($query)
{
return $query->where('status', 2);
}
/**
* Get list campaign
*
* @return Relationship
* @author goper
*/
public function campaign()
{
return $this->belongsTo('App\Models\EmailCampaign');
}
/**
* Get all subscribers
*
* @return Relationship
* @author goper
*/
public function subscribers()
{
return $this->hasMany('App\Models\EmailSubscriber');
}
}
<?php
namespace App\Modules\Email;
use App\Models\EmailList;
use App\Models\EmailSubscriber;
use Excel;
use Carbon\Carbon;
/**
* Email List module
*
* @author goper
*/
class SubscriberModule
{
protected $emailList;
protected $emailSubscriber;
public function __construct(EmailList $emailList, EmailSubscriber $emailSubscriber)
{
$this->emailList = $emailList;
$this->emailSubscriber = $emailSubscriber;
}
/**
* Save subscriber on list
* @param [type] $request [description]
*/
public function add($request)
{
return transact(function() use ($request)
{
$subscriber_hash = '';
$message = trans('cpanel.email.list.subscriber.add');
$email = $request->email;
$first_name = $request->first_name;
$last_name = $request->last_name;
$list = $this->emailList->findOrFail($request->email_list_id);
$model = $this->emailSubscriber->firstOrNew(['id' => $request->id]);
if ($request->has('id')) {
$subscriber_hash = $model->subscriber_hash;
$message = trans('cpanel.email.list.subscriber.edit');
}
$rating = 2;
$subscriber_hash = '';
if ($subscriber_hash == '') {
$mailchimp_response = add_subscriber($list->mailchimp_id, $email, $first_name, $last_name, $subscriber_hash);
if (!empty($mailchimp_response['errors'])) {
return get_mailchimp_error($mailchimp_response);
}
$rating = $mailchimp_response['member_rating'];
$subscriber_hash = $mailchimp_response['id'];
}
// After adding add/sync to mailchimp add to database
$model->email_list_id = $request->email_list_id;
$model->email = $email;
$model->first_name = $first_name;
$model->last_name = $last_name;
$model->rating = $rating;
$model->subscriber_hash = $subscriber_hash;
$model->save();
alert('success', $message);
return redirect()->route('cpanel.email.lists.subscribers', $request->email_list_id);
}, function($e) {
return errorify($e);
});
}
/**
* Mange page for subscribers
* @param [type] $id [description]
* @return [type] [description]
*/
public function manage($id)
{
$list = $this->emailList->findOrFail($id);
$this->synchMailchimpToDatabase($list);
return view('pages.cpanel.email.lists.subscribers.list', compact('list'));
}
/**
* // Upadate subscriber data especially on `subscriber_hash` column which are added to mailchimp useing `batch` opt
* @param [type] $list [description]
* @return [type] [description]
*/
private function synchMailchimpToDatabase($list)
{
$subscribers = $list->subscribers;
$allSubscriberNoHash = [];
$noHashSubscriberCount = 0;
foreach ($subscribers as $key => $subscriber) {
if ($subscriber->subscriber_hash == '' || is_null($subscriber->subscriber_hash)) {
$noHashSubscriberCount++;
$allSubscriberNoHash[$subscriber->email] = $subscriber->id;
}
}
// Check if some email have no hash before quesrying on mailchimp
if ($noHashSubscriberCount > 0) {
// First get subscribers on mailchimp using list_id
$response = mc_request('lists/' . $list->mailchimp_id . '/members');
foreach ($response['members'] as $key => $member) {
if (array_has($allSubscriberNoHash, $member['email_address'])) {
// This email has no hash get hash and update database value
$id = $allSubscriberNoHash[$member['email_address']];
$model = $this->emailSubscriber->findOrFail($id);
$model->subscriber_hash = $member['id'];
$model->rating = $member['member_rating'];
$model->save();
}
}
}
}
/**
* Delete email subscribers on database and on mailchimp
* @param [type] $request [description]
* @return [type] [description]
*/
public function delete($request)
{
return transact(function() use ($request)
{
$subscriber = $this->emailSubscriber->findOrFail($request->id);
$list = $subscriber->list;
$path = '/lists/' . $list->mailchimp_id . '/members/' . $subscriber->subscriber_hash;
$mailchimp_response = mc_request($path, 'delete');
if (!empty($mailchimp_response['errors'])) {
return get_mailchimp_error($mailchimp_response);
}
$subscriber->delete();
alert('success', trans('cpanel.email.list.subscriber.delete'));
return redirect()->route('cpanel.email.lists.subscribers', $list->id);
}, function($e) {
return errorify($e);
});
}
/**
* Export list into CSV
* @param [type] $list_id [description]
* @return [type] [description]
*/
public function export($id)
{
$list = $this->emailList->findOrFail($id);
$file_name = str_replace(' ', '_', $list->name . '_' . Carbon::now()->format('n-d-y'));
$header = ['Email', 'First Name', 'Last Name', 'Date Added'];
$data[] = $header;
foreach ($list->subscribers as $key => $subscriber) {
$subs[] = [
$subscriber->email,
$subscriber->first_name,
$subscriber->last_name,
Carbon::parse($subscriber->created_at)->format('M j, Y'),
];
}
$data = array_merge($data, $subs);
Excel::create($file_name, function($excel) use($data) {
$excel->sheet('Sheetname', function($sheet) use($data) {
$sheet->fromArray($data, null, 'A1', false, false);
});
})->download('csv');
}
public function readFile($request)
{
$csvFile = $request->file('file')->getRealPath();
$data = Excel::load($csvFile, function($reader) {})->get();
return jsonify(true, ['content' => $data->toArray()]);
}
public function save($request)
{
return transact(function() use ($request)
{
$emailListId = $request->list_id;
$list = $this->emailList->findOrFail($emailListId);
// Get all subscribers and save to array
$mailchimp_response = synch_mailchimp_subscribers($list->mailchimp_id, $request->subscribers);
if (!empty($mailchimp_response['errors'])) {
return get_mailchimp_error($mailchimp_response);
}
// Already synch to mailchimp now add to database
foreach ($request->subscribers as $key => $subscriber) {
$model = $this->emailSubscriber->firstOrNew(['email' => $subscriber['email']]);
$model->email_list_id = $emailListId;
$model->email = $subscriber['email'];
$model->first_name = array_key_exists('first_name', $subscriber) ? $subscriber['first_name'] : '';
$model->last_name = array_key_exists('last_name', $subscriber) ? $subscriber['last_name'] : '';
$model->rating = 2;
$model->subscriber_hash = '';
$model->save();
}
alert('success', trans('cpanel.email.list.subscriber.import.success'));
return redirect()->route('cpanel.email.lists.subscribers', $emailListId);
}, function($e) {
return errorify($e);
});
}
}
@extends(config('app.theme.master'))
@section('page_title', 'Lists')
@section('toolbar')
<div class="content-toolbar toolbarless">
<h3>Create List</h3>
</div>
@endsection
@section('main')
{!! Form::open(['route' => 'cpanel.email.lists.save']) !!}
<div class="row">
<div class="col-md-6 col-md-push-6 col-lg-5 col-lg-push-7">
<div class="well well-white">
<h3>Instruction</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
<div class="col-md-6 col-md-pull-6 col-lg-7 col-lg-pull-5">
{{-- Inlcude form --}}
@include('pages.cpanel.email.lists.widgets.list_form')
{{-- End of Form --}}
<div id="btn-wrapper" class="btn-wrapper">
<button type="submit" class="btn btn-success btn-round">
<span>Save</span>
</button>
<a href="{{ route('cpanel.email.lists') }}">Cancel</a>
</div>
</div>
</div>
{!! Form::close() !!}
@endsection
@push('scripts')
<script src="{{ url('assets/vendor/rumpelstiltskin/jquery.rumpelstiltskin.min.js') }}" charset="utf-8"></script>
@endpush
@push('scripts::inline')
<script type="text/javascript">
(function($) {
"use strict";
//**
$('.btn-wrapper').rumpelstiltskin({
className: 'affix-top',
offset: 220
});
})(jQuery);
</script>
@endpush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment