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

        $bannedEmail = $this->repository->findById($id);
        if (!$bannedEmail) {
            return $listener->notFound($id);
        }
        $bannedEmail->fill($input);
        $form = $this->presenter->form($bannedEmail);
        if (!$form->isValid()) {
            return $listener->updateBannedEmailFailedValidation($form->getMessageBag(), $id);
        }
        try {
            $this->repository->update($bannedEmail);
            $this->bannedEmailsService->saveToFile();
            return $listener->updateBannedEmailSuccess($bannedEmail);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->updateBannedEmailFailed(['error' => $e->getMessage()]);
        }
    }
public function update(BannedEmailUpdateListener $listener, $id, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $bannedEmail = $this->repository->findById($id);
        if (!$bannedEmail) {
            return $listener->notFound($id);
        }
        $bannedEmail->fill($input);
        $form = $this->presenter->form($bannedEmail);
        if (!$form->isValid()) {
            return $listener->updateBannedEmailFailedValidation($form->getMessageBag(), $id);
        }
        try {
            $this->repository->update($bannedEmail);
            $this->bannedEmailsService->saveToFile();
            return $listener->updateBannedEmailSuccess($bannedEmail);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->updateBannedEmailFailed(['error' => $e->getMessage()]);
        }
    }
public function update ( BannedEmailUpdateListener $ listener , $ id , array $ input ) { if ( empty ( array_get ( $ input , 'expired_at' ) ) ) { $ input [ 'expired_at' ] = null ; } $ bannedEmail = $ this -> repository -> findById ( $ id ) ; if ( ! $ bannedEmail ) { return $ listener -> notFound ( $ id ) ; } $ bannedEmail -> fill ( $ input ) ; $ form = $ this -> presenter -> form ( $ bannedEmail ) ; if ( ! $ form -> isValid ( ) ) { return $ listener -> updateBannedEmailFailedValidation ( $ form -> getMessageBag ( ) , $ id ) ; } try { $ this -> repository -> update ( $ bannedEmail ) ; $ this -> bannedEmailsService -> saveToFile ( ) ; return $ listener -> updateBannedEmailSuccess ( $ bannedEmail ) ; } catch ( Exception $ e ) { Log :: critical ( $ e -> getMessage ( ) ) ; return $ listener -> updateBannedEmailFailed ( [ 'error' => $ e -> getMessage ( ) ] ) ; } }
Updates the banned email in the repository.

@param BannedEmailUpdateListener $listener
@param int $id
@param array $input
@return JsonResponse
Updates the banned email in the repository .