ldc-crm/app/Http/Controllers/Api/V1/CustomerController.php

557 lines
21 KiB
PHP
Raw Permalink Normal View History

2020-12-01 17:02:10 +01:00
<?php
namespace App\Http\Controllers\Api\V1;
2020-12-01 17:02:10 +01:00
use App\Http\Controllers\Controller;
use App\Http\Resources\CustomerResource;
use App\Http\Resources\StatusResource;
2020-12-01 17:02:10 +01:00
use App\Models\Customer;
use App\Models\CustomerInfo;
2020-12-01 17:02:10 +01:00
use App\Models\CustomerLogin;
use App\Models\CustomerOptInHistory;
2020-12-02 10:08:27 +01:00
use App\Models\SingleOptin;
2020-12-01 17:02:10 +01:00
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
2020-12-01 17:02:10 +01:00
use Illuminate\Support\Str;
class CustomerController extends Controller
{
// TODO : Voir pour les contraintes de mot de passe
/**
* Store a newly created resource in storage
* @param Request $request
* @return CustomerResource|StatusResource
2020-12-01 17:02:10 +01:00
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required',
'firstname' => 'required',
'lastname' => 'required',
'opt_in' => 'required',
'birth_date' => 'date_format:Y-m-d'
]);
2020-12-01 17:02:10 +01:00
if ($validator->fails()) {
return new StatusResource([
'status' => 'KO', 'code' => 102,
'message' => 'Error on required fields.', 'errors' => $validator->errors()
]);
}
2021-03-14 10:45:42 +01:00
$brandId = $request->brand_id;
$email = strtolower(filter_var($request->email, FILTER_SANITIZE_EMAIL));
2020-12-01 17:02:10 +01:00
$firstname = filter_var($request->firstname, FILTER_SANITIZE_STRING);
2021-03-14 10:45:42 +01:00
$lastname = filter_var($request->lastname, FILTER_SANITIZE_STRING);
$optIn = filter_var($request->opt_in, FILTER_SANITIZE_STRING);
$hashcode = Str::uuid();
2020-12-01 17:02:10 +01:00
// Récupère le customer s'il existe déjà
$customer = Customer::where('email', $email)->first();
// Si le customer n'existe pas déjà
if (!$customer) {
2021-07-22 15:14:07 +02:00
$customer = new Customer();
$customer->email = $email;
2020-12-01 17:02:10 +01:00
$customer->save();
2020-12-02 10:08:27 +01:00
$singleOptin = SingleOptin::where([['email', $email], ['brand_id', $brandId]])->first();
if ($singleOptin) {
2020-12-02 10:08:27 +01:00
$singleOptin->delete();
}
2020-12-01 17:02:10 +01:00
} else {
// Récupère les infos s'ils existent déjà
$CustomerInfo = CustomerInfo::where([['customer_id', $customer->id], ['brand_id', $brandId]])->first();
if ($CustomerInfo) {
return new StatusResource([
'status' => 'KO', 'code' => 103,
'message' => 'User already registered on this site.'
]);
}
2020-12-01 17:02:10 +01:00
}
2021-07-22 15:14:07 +02:00
$customerInfos = new CustomerInfo();
$customerInfos->firstname = ucfirst(strtolower($firstname));
$customerInfos->lastname = ucfirst(strtolower($lastname));
$customerInfos->birth_date = !empty($request->birth_date) ?
filter_var($request->birth_date, FILTER_SANITIZE_STRING) : null;
$customerInfos->address = !empty($request->address) ?
filter_var($request->address, FILTER_SANITIZE_STRING) : null;
$customerInfos->address2 = !empty($request->address2) ?
filter_var($request->address2, FILTER_SANITIZE_STRING) : null;
$customerInfos->phone = !empty($request->phone) ?
filter_var($request->phone, FILTER_SANITIZE_STRING) : null;
$customerInfos->country = !empty($request->country) ?
filter_var($request->country, FILTER_SANITIZE_STRING) : null;
$customerInfos->city = !empty($request->city) ?
filter_var($request->city, FILTER_SANITIZE_STRING) : null;
$customerInfos->postcode = !empty($request->postcode) ?
filter_var($request->postcode, FILTER_SANITIZE_STRING) : null;
$customerInfos->opt_in = $optIn;
$customerInfos->hashcode = $hashcode;
$customerInfos->brand_id = $brandId;
2020-12-01 17:02:10 +01:00
$customerInfos->customer_id = $customer->id;
$customer->infos()->save($customerInfos);
// Création du login pour cet utilisateur sur ce service
2021-03-14 10:45:42 +01:00
$customerLogin = new CustomerLogin();
$customerLogin->customer_id = $customer->id;
$customerLogin->password = Hash::make(trim($request->password));
2020-12-01 17:02:10 +01:00
$customerLogin->last_connection = now();
2021-03-14 10:45:42 +01:00
$customerLogin->brand_id = $brandId;
$customerLogin->status = 0;
2020-12-01 17:02:10 +01:00
$customer->logins()->save($customerLogin);
// Ajout dans la table d'historique des opt-in de la nouvelle valeur
2021-03-14 10:45:42 +01:00
$optInHistory = new CustomerOptInHistory();
2020-12-01 17:02:10 +01:00
$optInHistory->customer_id = $customer->id;
2021-03-14 10:45:42 +01:00
$optInHistory->brand_id = $brandId;
$optInHistory->new_value = $optIn;
2020-12-01 17:02:10 +01:00
$optInHistory->save();
return new CustomerResource($customer, $brandId);
}
/**
* Display the specified resource.
*
* @param int $id
* @return CustomerResource | StatusResource
2020-12-01 17:02:10 +01:00
*/
2021-02-17 16:05:11 +01:00
public function show(Request $request, $type, $value)
2020-12-01 17:02:10 +01:00
{
$brandId = $request->brand_id;
2021-02-17 16:05:11 +01:00
if ($type === 'id') {
2021-02-17 16:05:11 +01:00
$customer = Customer::find($value);
if (!$customer) {
2021-02-17 16:05:11 +01:00
return new StatusResource(['status' => 'KO', 'code' => 101, 'message' => 'User not found.']);
}
} elseif ($type === 'email') {
2021-02-17 16:05:11 +01:00
$customer = Customer::where('email', $value)->first();
if (!$customer) {
2021-02-17 16:05:11 +01:00
return new StatusResource(['status' => 'KO', 'code' => 101, 'message' => 'User not found.']);
}
2021-02-17 16:05:11 +01:00
$CustomerInfo = $customer->infos()->where('brand_id', $brandId)->first();
2021-02-17 16:05:11 +01:00
if (!$CustomerInfo) {
2021-02-17 16:05:11 +01:00
return new StatusResource(['status' => 'KO', 'code' => 101, 'message' => 'User not found.']);
}
} else {
return new StatusResource(['status' => 'KO', 'code' => 101, 'message' => 'User not found.']);
2021-02-17 16:05:11 +01:00
}
return new CustomerResource($customer, $brandId);
2020-12-01 17:02:10 +01:00
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return CustomerResource|StatusResource
2020-12-01 17:02:10 +01:00
*/
2021-07-22 15:14:07 +02:00
// phpcs:ignore Generic.Metrics.CyclomaticComplexity.MaxExceeded
2020-12-01 17:02:10 +01:00
public function update(Request $request, $id)
{
$validator = Validator::make($request->all(), [
'birth_date' => 'date_format:Y-m-d'
]);
if ($validator->fails()) {
return new StatusResource([
'status' => 'KO', 'code' => 104,
'message' => 'Error on required fields.', 'errors' => $validator->errors()
]);
}
2021-03-14 10:45:42 +01:00
$brandId = $request->brand_id;
2020-12-01 17:02:10 +01:00
$customer = Customer::find($id);
if (!$customer) {
return new StatusResource(['status' => 'KO', 'code' => 105, 'message' => 'User not found.']);
}
2020-12-01 17:02:10 +01:00
$CustomerInfo = $customer->infos()->where('brand_id', $brandId)->first();
if (!$CustomerInfo) {
2021-02-19 16:32:08 +01:00
return new StatusResource(['status' => 'KO', 'code' => 105, 'message' => 'User not found.']);
}
2020-12-01 17:02:10 +01:00
2021-07-22 15:14:07 +02:00
if ($request->has('firstname')) {
$CustomerInfo->firstname = filter_var($request->firstname, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
}
2020-12-01 17:02:10 +01:00
2021-07-22 15:14:07 +02:00
if ($request->has('lastname')) {
$CustomerInfo->lastname = filter_var($request->lastname, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
}
2020-12-01 17:02:10 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('birth_date')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->birth_date)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->birth_date = filter_var($request->birth_date, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->birth_date = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('address')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->address)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->address = filter_var($request->address, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->address = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('address2')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->address2)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->address2 = filter_var($request->address2, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->address2 = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('phone')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->phone)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->phone = filter_var($request->phone, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->phone = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('country')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->country)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->country = filter_var($request->country, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->country = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('city')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->city)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->city = filter_var($request->city, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->city = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('postcode')) {
2021-07-22 15:14:07 +02:00
if (!empty($request->postcode)) {
2021-07-22 14:44:54 +02:00
$CustomerInfo->postcode = filter_var($request->postcode, FILTER_SANITIZE_STRING);
2021-07-22 15:14:07 +02:00
} else {
2021-07-22 14:44:54 +02:00
$CustomerInfo->postcode = null;
2021-04-30 11:12:11 +02:00
}
}
2021-02-23 17:39:23 +01:00
2021-04-30 11:37:48 +02:00
if ($request->has('opt_in')) {
2021-02-23 17:39:23 +01:00
$optIn = filter_var($request->opt_in, FILTER_SANITIZE_STRING);
if ($CustomerInfo->opt_in != $optIn) {
2021-02-23 17:39:23 +01:00
// Ajout dans la table d'historique des opt-in de la nouvelle valeur
2021-03-14 10:45:42 +01:00
$optInHistory = new CustomerOptInHistory();
2021-02-23 17:39:23 +01:00
$optInHistory->customer_id = $customer->id;
2021-03-14 10:45:42 +01:00
$optInHistory->brand_id = $brandId;
$optInHistory->new_value = $optIn;
2021-02-23 17:39:23 +01:00
$optInHistory->save();
}
$CustomerInfo->opt_in = $optIn;
2021-02-23 17:39:23 +01:00
}
2020-12-01 17:02:10 +01:00
$CustomerInfo->save();
2020-12-01 17:02:10 +01:00
return new CustomerResource($customer, $brandId);
}
/**
* Authenticate the user
* @param Request $request
* @return CustomerResource|StatusResource
2020-12-01 17:02:10 +01:00
*/
public function authenticate(Request $request)
{
$validator = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required',
]);
if ($validator->fails()) {
return new StatusResource([
'status' => 'KO', 'code' => 115,
'message' => 'Error on required fields.', 'errors' => $validator->errors()
]);
}
2021-03-14 10:45:42 +01:00
$brandId = $request->brand_id;
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
2020-12-01 17:02:10 +01:00
$password = trim($request->password);
$customer = Customer::where('email', $email)->first();
if ($customer) {
$login = $customer->logins()->where('brand_id', $brandId)->first();
if ($login) {
2021-02-17 14:38:37 +01:00
if (Hash::check($password, $login->password)) {
2021-10-26 12:01:40 +02:00
if ($login->status === false) {
2021-02-17 15:24:31 +01:00
$infos = $customer->infos()->where('brand_id', $brandId)->first();
2021-02-17 14:38:37 +01:00
// "Le compte de l'utilisateur n'est pas activé"
return new StatusResource(
[
'status' => 'KO',
'code' => 116,
'message' => 'Account not activated.',
'user' => [
'crm_id' => $customer->id,
2021-02-17 15:24:31 +01:00
'firstname' => $infos->firstname,
'lastname' => $infos->lastname,
2021-06-23 10:20:57 +02:00
'email' => $customer->email,
2021-02-17 15:24:31 +01:00
'birth_date' => $infos->birth_date,
'address' => $infos->address,
'address2' => $infos->address2,
'phone' => $infos->phone,
'country' => $infos->country,
'city' => $infos->city,
'postcode' => $infos->postcode,
'opt_in' => $infos->opt_in,
'hashcode' => $infos->hashcode,
2021-02-17 14:38:37 +01:00
'status' => $login->status,
]
]
);
2020-12-01 17:02:10 +01:00
}
2021-02-17 14:38:37 +01:00
$login->last_connection = now();
$customer->logins()->save($login);
return new CustomerResource($customer, $brandId);
2020-12-01 17:02:10 +01:00
}
2021-02-17 14:38:37 +01:00
// "Mot de passe incorrect"
return new StatusResource(['status' => 'KO', 'code' => 117, 'message' => 'Authentication failed.']);
2020-12-01 17:02:10 +01:00
} else {
// "Ce compte n'est pas enregistré pour cette marque"
return new StatusResource(['status' => 'KO', 'code' => 118, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
} else {
// "Ce compte n'existe pas dans la CRM"
return new StatusResource(['status' => 'KO', 'code' => 119, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
}
/**
* Change the password of the user for the brand
* @param Request $request
* @param $id
2020-12-01 17:02:10 +01:00
*/
public function changePassword(Request $request, $id)
{
$validator = Validator::make($request->all(), [
'password' => 'required',
]);
2020-12-01 17:02:10 +01:00
if ($validator->fails()) {
return new StatusResource([
'status' => 'KO', 'code' => 107,
'message' => 'Error on required fields.', 'errors' => $validator->errors()
]);
}
2021-03-14 10:45:42 +01:00
$brandId = $request->brand_id;
$customer = Customer::find($id);
2020-12-01 17:02:10 +01:00
$password = trim($request->password);
if ($customer) {
$customerLogin = $customer->logins()->where('brand_id', $brandId)->first();
if ($customerLogin) {
// Check if same password
2021-03-14 10:45:42 +01:00
if (Hash::check($password, $customerLogin->password)) {
return new StatusResource(['status' => 'KO', 'code' => 123, 'message' => 'Same password.']);
}
2020-12-01 17:02:10 +01:00
$customerLogin->password = Hash::make($password);
$customerLogin->save();
} else {
// "Ce compte n'est pas enregistré pour cette marque"
return new StatusResource(['status' => 'KO', 'code' => 108, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
} else {
// "Ce compte n'existe pas"
return new StatusResource(['status' => 'KO', 'code' => 109, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
return new StatusResource(['status' => 'OK', 'message' => 'Update complete.']);
2020-12-01 17:02:10 +01:00
}
/**
* Activate the account of the user
* @param Request $request
* @param $id
2020-12-01 17:02:10 +01:00
*/
public function activateAccount(
Request $request,
$id
) {
2020-12-01 17:02:10 +01:00
$brandId = $request->brand_id;
$customer = Customer::find($id);
if ($customer) {
$login = $customer->logins()->where('brand_id', $brandId)->first();
if ($login) {
2021-10-26 12:01:40 +02:00
if ($login->status === false) {
$login->status = true;
2020-12-01 17:02:10 +01:00
$login->save();
// "Le compte a bien été activé"
return new StatusResource(['status' => 'OK', 'message' => 'Update complete.']);
2020-12-01 17:02:10 +01:00
} else {
// "Ce compte est déjà activé"
return new StatusResource(['status' => 'KO', 'code' => 110, 'message' => 'User already active.']);
2020-12-01 17:02:10 +01:00
}
} else {
// "Ce compte n'est pas enregistré pour cette marque"
return new StatusResource(['status' => 'KO', 'code' => 111, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
} else {
// "Cet utilisateur n'existe pas dans la CRM"
return new StatusResource(['status' => 'KO', 'code' => 112, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
}
/**
* Delete the user account for the brand
* @param Request $request
* @param $id
2020-12-01 17:02:10 +01:00
*/
2021-07-22 15:14:07 +02:00
// phpcs:disable Squiz.PHP.NonExecutableCode.Unreachable
public function delete(Request $request, $id)
{
2020-12-01 17:14:02 +01:00
die("Not implemented yet");
// TODO : A voir pour les stats, obuton dans le bo qui permet de faire les stats sur les customer puis supprimer
// TODO : Gestion avec mesBR
2020-12-01 17:02:10 +01:00
$brandId = $request->brand_id;
$customer = Customer::find($id);
if ($customer) {
$customer->infos()->where('brand_id', $brandId)->first()->delete();
$customer->logins()->where('brand_id', $brandId)->first()->delete();
if (count($customer->infos) === 0 && count($customer->logins) === 0) {
$customer->optInHistory()->delete();
$customer->delete();
// Suppression du compte de la CRM terminée
return new StatusResource(['status' => 'OK', 'message' => 'Deletion complete.']);
2020-12-01 17:02:10 +01:00
} else {
// Suppression des informations du compte pour la marque terminée
return new StatusResource(['status' => 'OK', 'message' => 'Deletion complete.']);
2020-12-01 17:02:10 +01:00
}
} else {
return new StatusResource(['status' => 'KO', 'code' => 106, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
}
/**
* Change the status of the opt-in for the customer on this brand
* @param Request $request
* @param $id
2020-12-01 17:02:10 +01:00
*/
public function toggleOptin(Request $request, $id)
{
2020-12-01 17:02:10 +01:00
// TODO : Liaison des opt-in avec MailJet
$brandId = $request->brand_id;
$customer = Customer::find($id);
if ($customer) {
$infos = $customer->infos()->where('brand_id', $brandId)->first();
if ($infos) {
$infos->opt_in = $infos->opt_in === 0 ? 1 : 0;
// On enregistre l'historique du changement d'optin
2021-03-14 10:45:42 +01:00
$optinHistory = new CustomerOptInHistory();
2020-12-01 17:02:10 +01:00
$optinHistory->customer_id = $customer->id;
2021-03-14 10:45:42 +01:00
$optinHistory->new_value = $infos->opt_in;
$optinHistory->brand_id = $brandId;
2020-12-01 17:02:10 +01:00
$optinHistory->save();
$infos->save();
// "Changement effectué"
return new StatusResource(['status' => 'OK', 'message' => 'Update complete.']);
2020-12-01 17:02:10 +01:00
} else {
// "Ce compte n'a pas d'information liés à cette marque"
return new StatusResource(['status' => 'KO', 'code' => 113, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
} else {
// "Cet utilisateur n'existe pas dans la CRM"
return new StatusResource(['status' => 'KO', 'code' => 114, 'message' => 'User not found.']);
2020-12-01 17:02:10 +01:00
}
}
/**
* Remove opt-in for the customer on this brand
* @param Request $request
* @param $hashcode
*/
2021-03-14 10:45:42 +01:00
public function removeOptin(Request $request, $hashcode)
{
// TODO : Liaison des opt-in avec MailJet
$brandId = $request->brand_id;
2021-03-14 10:45:42 +01:00
$infos = CustomerInfo::where([
['brand_id', $brandId],
['hashcode', $hashcode]
])->first();
if ($infos) {
$infos->opt_in = 0;
// On enregistre l'historique du changement d'optin
2021-03-14 10:45:42 +01:00
$optinHistory = new CustomerOptInHistory();
$optinHistory->customer_id = $infos->customer_id;
2021-03-14 10:45:42 +01:00
$optinHistory->new_value = 0;
$optinHistory->brand_id = $brandId;
$optinHistory->save();
$infos->save();
// "Changement effectué"
return new StatusResource(['status' => 'OK', 'message' => 'Update complete.']);
} else {
// "Ce compte n'a pas d'information liés à cette marque"
return new StatusResource(['status' => 'KO', 'code' => 122, 'message' => 'User not found.']);
}
}
2021-03-14 10:45:42 +01:00
public function addSingleOptin(Request $request)
{
$validator = Validator::make($request->all(), [
'email' => 'required|email',
]);
if ($validator->fails()) {
return new StatusResource([
'status' => 'KO', 'code' => 120,
'message' => 'Error on required fields.', 'errors' => $validator->errors()
]);
}
2020-12-02 10:08:27 +01:00
$brandId = $request->brand_id;
2021-03-14 10:45:42 +01:00
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
2020-12-02 10:08:27 +01:00
// Check si le customer ou l'optin simple existe avant de l'ajouter en optin simple
// phpcs:ignore PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace
if (
!SingleOptin::where([['email', $email], ['brand_id', $brandId]])->exists() &&
!CustomerInfo::join("customers", "customer_infos.customer_id", "=", "customers.id")->where([
['brand_id', $brandId], ['email', $email]
])->exists()
) {
2021-03-14 10:45:42 +01:00
$singleOptin = new SingleOptin();
$singleOptin->email = $email;
2020-12-02 10:08:27 +01:00
$singleOptin->brand_id = $brandId;
$singleOptin->save();
} else {
// "Cet utilisateur est déjà inscrit à la newsletter pour cette marque"
return new StatusResource([
'status' => 'KO', 'code' => 121,
'message' => 'This user is already subscribed to the newsletter for this brand.'
]);
2020-12-02 10:08:27 +01:00
}
return new StatusResource(['status' => 'OK', 'message' => 'Optin added.']);
2020-12-02 10:08:27 +01:00
}
2020-12-01 17:02:10 +01:00
}