I am making an admin area as an easy way to keep track of my subscribers. All I want is to display and update their email address every time someone new subscribes to my list. As shown below I want the email addresses to go under email. I am sure there is some sort of code that I need to use to get subscriber information and display it, but I am not sure where to get it. I am using the laravel package https://github.com/skovmand/mailchimp-laravel
Here is my mailchimp conbtroller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class MailChimpController extends Controller
{
public $mailchimp;
public $listId = '111111111';
public function __construct(\Mailchimp $mailchimp)
{
$this->mailchimp = $mailchimp;
}
public function manageMailChimp()
{
return view('mailchimp');
}
public function subscribe(Request $request)
{
$this->validate($request, [
'email' => 'required|email',
]);
try {
$this->mailchimp
->lists
->subscribe(
$this->listId,
['email' => $request->input('email')]
);
return redirect()->back()->with('success','Email Subscribed successfully');
} catch (\Mailchimp_List_AlreadySubscribed $e) {
return redirect()->back()->with('error','Email is Already Subscribed');
} catch (\Mailchimp_Error $e) {
return redirect()->back()->with('error','Error from MailChimp');
}
}
}
and here is my admin.blade.php file I want the email addresses to be displayed.
@extends('layouts.app')
@section('content')
<div class="container">
<h1 class="text-center">Subscribers</h1>
<table class="table">
<thead>
<tr>
<th>Check</th>
<th>Email</th>
<th>City</th>
<th>Airport</th>
</tr>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</thead>
</table>
</div>
@endsection
Let me know if there is anything else I need. Any help would be appreciated!