src/AbstractRepository.php
protected function perform($action, $object, $attributes = array(), $validate = true)
	{
		$perform = 'perform' . ucfirst($action);
		if (!method_exists($this, $perform)) {
			throw new \BadMethodCallException("Method $perform does not exist on this class");
		}

		if ($validate === true) {
			if ($this->validateEntity) {
				if (!$this->valid($action, $this->getEntityAttributes($object))) return false;
			} else {
				if (!$this->valid($action, $attributes)) return false;
			}
		}

		$beforeResult = $this->doBefore($action, $object, $attributes);
		if ($beforeResult === false) return $beforeResult;

		$result = call_user_func_array([$this, $perform], [$object, $attributes]);
		if ($result === false) return $result;

		$this->doAfter($action, $result, $attributes);

		return $result;
	}
protected function perform($action, $object, $attributes = array(), $validate = true)
	{
		$perform = 'perform' . ucfirst($action);
		if (!method_exists($this, $perform)) {
			throw new \BadMethodCallException("Method $perform does not exist on this class");
		}

		if ($validate === true) {
			if ($this->validateEntity) {
				if (!$this->valid($action, $this->getEntityAttributes($object))) return false;
			} else {
				if (!$this->valid($action, $attributes)) return false;
			}
		}

		$beforeResult = $this->doBefore($action, $object, $attributes);
		if ($beforeResult === false) return $beforeResult;

		$result = call_user_func_array([$this, $perform], [$object, $attributes]);
		if ($result === false) return $result;

		$this->doAfter($action, $result, $attributes);

		return $result;
	}
Perform an action.

Calls $this->before{$action} and $this->after{$action} before or after
$this->perform{action} has been called. Also calls $this->valid($action,
$attributes) for validation.

@param  string  $action
@param  mixed   $object
@param  mixed   $attributes
@param  boolean $validate

@return mixed