public function store(BannedEmailStoreListener $listener, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $bannedEmail = new BannedEmail();
        $bannedEmail->fill($input);

        $form = $this->presenter->form($bannedEmail);

        if (!$form->isValid()) {
            return $listener->createBannedEmailFailedValidation($form->getMessageBag());
        }
        try {
            $this->repository->store($bannedEmail);
            $this->bannedEmailsService->saveToFile();
            return $listener->storeBannedEmailSuccess($bannedEmail);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->storeBannedEmailFailed(['error' => $e->getMessage()]);
        }
    }
public function store(BannedEmailStoreListener $listener, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $bannedEmail = new BannedEmail();
        $bannedEmail->fill($input);

        $form = $this->presenter->form($bannedEmail);

        if (!$form->isValid()) {
            return $listener->createBannedEmailFailedValidation($form->getMessageBag());
        }
        try {
            $this->repository->store($bannedEmail);
            $this->bannedEmailsService->saveToFile();
            return $listener->storeBannedEmailSuccess($bannedEmail);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->storeBannedEmailFailed(['error' => $e->getMessage()]);
        }
    }
public function store ( BannedEmailStoreListener $ listener , array $ input ) { if ( empty ( array_get ( $ input , 'expired_at' ) ) ) { $ input [ 'expired_at' ] = null ; } $ bannedEmail = new BannedEmail ( ) ; $ bannedEmail -> fill ( $ input ) ; $ form = $ this -> presenter -> form ( $ bannedEmail ) ; if ( ! $ form -> isValid ( ) ) { return $ listener -> createBannedEmailFailedValidation ( $ form -> getMessageBag ( ) ) ; } try { $ this -> repository -> store ( $ bannedEmail ) ; $ this -> bannedEmailsService -> saveToFile ( ) ; return $ listener -> storeBannedEmailSuccess ( $ bannedEmail ) ; } catch ( Exception $ e ) { Log :: critical ( $ e -> getMessage ( ) ) ; return $ listener -> storeBannedEmailFailed ( [ 'error' => $ e -> getMessage ( ) ] ) ; } }
Stores the banned email in the repository.

@param BannedEmailStoreListener $listener
@param array $input
@return JsonResponse
Stores the banned email in the repository .