/** * @test */ public function it_correctly_subscribes_the_email_to_the_list() { $email = $this->faker->email; $mailchimp = new MC($this->apiKey); $response = $mailchimp->subscribe('accf6b0a0e', $email); $this->assertEquals($email, $response['email']); }
/** * @param Request $request * @return mixed */ public function store(Request $request) { try { $mc = new MC(); $response = $mc->subscribe($request->input('email')); return response()->json(['data' => $response]); } catch (Exception $e) { return response()->json(['error' => $e->getMessage()]); } }