<?php

namespace Modules\Newsletter\Controllers\Web;

/** Ajax Request */

use App\Http\Controllers\Controller;
use App\Services\Response\ResponseService;
use Modules\Newsletter\Requests\Web\NewsletterRequest;
use Modules\Newsletter\Services\NewsletterService;

class NewsletterController extends Controller
{

    public function __construct(
        private NewsletterService $newsletterService,
    ){}

    public function newsletter(NewsletterRequest $request)
    {
        $this->newsletterService->save($request,null);

        $response = [
            'status'=>200,
            'message'=>__('web.success'),
            'data'=> url()->previous(),
        ];
        return ResponseService::response($response);
    }
}
