Store Data into Database
@param $data
@return int|string
324199
public function insertBean($data)
    {
        $bean = R::xdispense($this->tableName);



        $result =  $this->saveBean($bean, $data);

        if (empty($result->msg)) {
            $result->msg = "The record has been created successfully.";
            $result->class = "callout-info";
            $result->ok = true;
        } else {
            $result->ok = false;
            $result->class = "callout-danger";

        }

        if ($this->afterInsertBean != null) {
            $callable = $this->afterInsertBean;
            $callable($bean, $result);
        }

        return $result;
    }
49858
public function store($data)
    {
        $template = $this->client->post('templates.json', [
            'json' => $data,
        ]);

        return new Template($this->response($template));
    }
911451
public function populate($data=array())
    {
    	foreach ($data as $k=>$v)
    	{
    		// Promise that if this is a new record, we aren't handling any end-user data for $data
    		if ($this->isNewRecord)
    			$this->$k = $v;
    		else
    		{
	    		if(isset($this->attributes[$k]))
	    			$this->$k = $v;
	    	}
    	}

    	return $this->attributes;
    }
30058
private function store($data)
    {
        if (array_key_exists('txn_id', $data)) {
            $order = IpnOrder::firstOrNew(array('txn_id' => $data['txn_id']));
            $order->fill($data);
        } else {
            $order = new IpnOrder($data);
        }
        $order->full_ipn = json_encode(Input::all());
        $order->save();

        $this->storeOrderItems($order, $data);

        return $order;
    }
905819
public function set($data) {
		return static::$APCavailable ? apc_store($this->key, $data, $this->ttl) : false;
// 		return static::$useAPCu ? apcu_store($this->key, $data, $this->ttl) : apc_store($this->key, $data, $this->ttl);
	}
209783
public function add($data = [])
    {
        $insertId = $this->db->insert($this->table, $data);
        if ($insertId) {
            return (int) $insertId;
        }

        return 0;
    }
507255
public function create_data( $data = [] ) {
		if ( is_object( $data ) && method_exists( $data, 'to_array' )  ) {
			return $data->to_array();
		}

		return is_array( $data ) ? $data : [];
	}
1134037
public function unserialize($data)
    {
        $data = unserialize($data);

        $this->setData($data);

        return $this->getData();
    }
917928
public static function encode($data)
    {
        switch (gettype($data)) {
            case 'array':
                return self::encodeArray($data);
            case 'object':
                return self::encodeObject($data);
            case 'string':
                return self::encodeString($data);
            case 'integer':
                return self::encodeInteger($data);
            case 'boolean':
                return self::encodeBoolean($data);
            case 'double':
                return self::encodeDouble($data);
            case 'NULL':
                return self::encodeNull($data);
            case 'resource':
                // TODO
                break;
            default:
                throw new UnencodeableException('Contains unencodeable type', 3);
        }
    }
1033316
public function setDatabaseInfo($data)
    {
        $data['host'] = $data['host'].':'.$data['port'];

        unset($data['port']);

        $keys = array_map(function($key) {
            return 'database_'.$key;
        }, array_keys($data));

        $data = array_combine($keys, array_values($data));

        $this->set($data);
    }
122149
public function update(array $data): int
    {
        $this->builder->setUpdateData($data);
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->execSql($sql);
    }
882609
final public function save(array $data)
    {
        return array_key_exists('id', $data) ?
            $this->update($data) :
            $this->insert($data);
    }
1143044
public function setDataObject($data)
    {
        if (true === is_object($data)) {
            $data = json_encode($data);
        }

        return $this->setData($data);
    }
1200979
public function assignData($data)
    {
        $storeId = $this->getInfoInstance()->getQuote()->getStoreId();
        $details = array();

        if ($this->getAccountName()) {
            $details['account_name'] = $this->getAccountName($storeId);
        }

        if ($this->getAccountBSB()) {
            $details['account_bsb'] = $this->getAccountBSB($storeId);
        }

        if ($this->getAccountNumber()) {
            $details['account_number'] = $this->getAccountNumber($storeId);
        }

        if ($this->getMessage()) {
            $details['message'] = $this->getMessage($storeId);
        }

        if (!empty($details)) {
            $this->getInfoInstance()->setAdditionalData(serialize($details));
        }

        return $this;
    }
1160616
public function insert($data) {
        $map = $this->extractMap($data);
        $sql = "INSERT INTO $this->KVS_TABLE ($this->KVS_FK_NAME, $this->KVS_SK_NAME,
            uk1, sk1, tk1, co1, co2, json_body, created_at)
            VALUES (:foreign_key, :secondary_key, :uk1, :sk1, :tk1, :co1, :co2, :json_body, $this->NOW)";
        $map[':foreign_key'] = $this->KVS_FK;
        $map[':secondary_key'] = $this->KVS_SK;

        $copy = self::preStoreCleanup($data);
        $map[':json_body'] = json_encode($copy);
        $stmt = $this->PDOX->queryDie($sql, $map);

        if ( $stmt->success) return(intval($this->PDOX->lastInsertId()));
        return false;
    }
1356325
public function assignData($data)
    {
        $billerCode = $this->getBillerCode();
        $ref        = $this->getRef();
        
        $info = $this->getInfoInstance();
        $info->setBillerCode($billerCode);
        $info->setRef($ref);

        $details = array();

        if ($this->getBillerCode()) {
            $details['biller_code'] = $billerCode;

            if ($this->getRef()) {
                $details['ref'] = $ref;
            }
        }
        
        if (!empty($details)) {
            $this->getInfoInstance()->setAdditionalData(serialize($details));
        }
        
        return $this;
    }
118635
public function create($data)
    {
        $data = $this->retrieveData($data);
        $insertData = [
            'user_id' => $this->getUserId(),
            'role_id' => $data['role_id'],
        ];
        $this->table->insert($insertData);
        return $data;
    }