protected function parametersOfUniqueConstraint($key, array $originalParameters, AppliesToResource $resource=null)
    {
        if (!$resource instanceof Entity) {
            return $originalParameters;
        }

        if (!$resource instanceof EloquentModel) {
            return $originalParameters;
        }

        // No support for nested keys currently
        if (strpos($key, '.') !== false) {
            return $originalParameters;
        }

        $table = $resource->getTable();
        $uniqueKey = $key;

        if ($resource->isNew()) {
            return [$table, $uniqueKey];
        }

        $id = $resource->getId();
        $primaryKey = $resource->getKeyName();

        return [$table, $uniqueKey, $id, $primaryKey];
    }
protected function parametersOfUniqueConstraint($key, array $originalParameters, AppliesToResource $resource=null)
    {
        if (!$resource instanceof Entity) {
            return $originalParameters;
        }

        if (!$resource instanceof EloquentModel) {
            return $originalParameters;
        }

        // No support for nested keys currently
        if (strpos($key, '.') !== false) {
            return $originalParameters;
        }

        $table = $resource->getTable();
        $uniqueKey = $key;

        if ($resource->isNew()) {
            return [$table, $uniqueKey];
        }

        $id = $resource->getId();
        $primaryKey = $resource->getKeyName();

        return [$table, $uniqueKey, $id, $primaryKey];
    }
protected function parametersOfUniqueConstraint ( $ key , array $ originalParameters , AppliesToResource $ resource = null ) { if ( ! $ resource instanceof Entity ) { return $ originalParameters ; } if ( ! $ resource instanceof EloquentModel ) { return $ originalParameters ; } // No support for nested keys currently if ( strpos ( $ key , '.' ) !== false ) { return $ originalParameters ; } $ table = $ resource -> getTable ( ) ; $ uniqueKey = $ key ; if ( $ resource -> isNew ( ) ) { return [ $ table , $ uniqueKey ] ; } $ id = $ resource -> getId ( ) ; $ primaryKey = $ resource -> getKeyName ( ) ; return [ $ table , $ uniqueKey , $ id , $ primaryKey ] ; }
Calculate the unique parameters for the uniqueParameters.

@param string            $key
@param array             $originalParameters
@param AppliesToResource $resource (optional)

@return array
Calculate the unique parameters for the uniqueParameters .