public function destroy(RuleListener $listener, $id)
    {
        $rule = $this->repository->findById($id);

        if (!$rule) {
            return $listener->notFound($id);
        }

        try {
            $this->fireEvent('deleting', [$rule]);
            $this->repository->delete($rule);
            $this->fireEvent('deleted', [$rule]);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->deleteRuleFailed(['error' => $e->getMessage()]);
        }

        return $listener->deleteRuleSuccess();
    }
public function destroy(RuleListener $listener, $id)
    {
        $rule = $this->repository->findById($id);

        if (!$rule) {
            return $listener->notFound($id);
        }

        try {
            $this->fireEvent('deleting', [$rule]);
            $this->repository->delete($rule);
            $this->fireEvent('deleted', [$rule]);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->deleteRuleFailed(['error' => $e->getMessage()]);
        }

        return $listener->deleteRuleSuccess();
    }
public function destroy ( RuleListener $ listener , $ id ) { $ rule = $ this -> repository -> findById ( $ id ) ; if ( ! $ rule ) { return $ listener -> notFound ( $ id ) ; } try { $ this -> fireEvent ( 'deleting' , [ $ rule ] ) ; $ this -> repository -> delete ( $ rule ) ; $ this -> fireEvent ( 'deleted' , [ $ rule ] ) ; } catch ( Exception $ e ) { Log :: critical ( $ e -> getMessage ( ) ) ; return $ listener -> deleteRuleFailed ( [ 'error' => $ e -> getMessage ( ) ] ) ; } return $ listener -> deleteRuleSuccess ( ) ; }
Removes the rule from the repository.

@param RuleListener $listener
@param int $id
@return mixed
Removes the rule from the repository .