INSERT INTO 'email'

@param   array   $data      The data to be saved, which is already validated, washed, & prepped.
@return  mixed              The new emails.id when save is successful, false when save fails
511817
public function createNewRecord($data) {

        $email = new $this->model;

        $email->email_type_id = $data['email_type_id'];
        $email->title         = $data['title'];
        $email->description   = $data['description'];
        $email->comments      = $data['comments'];
        $email->created_at    = $data['created_at'];
        $email->created_by    = $data['created_by'];
        $email->updated_at    = $data['updated_at'];
        $email->updated_by    = $data['updated_by'];
        $email->locked_at     = null;
        $email->locked_by     = null;

        if ($email->save()) {

            // Return the new ID
            return $email->id;
        }

        return false;
    }
976730
protected function _insert(array $data = array())
    {
        if (!is_null($this->_table)) {
            $this->_affectedRows = $this->_db->insert($this->_table, $data);
            if ($this->_affectedRows > 0) {
                $this->id = $this->_db->lastInsertId();
            }
            return $this->_affectedRows;
        }
    }
41745
public function insert(array $data = array(), $update = false)
    {
        $this->viewCheck(__FUNCTION__);

        $data = array_merge($this->_schema['init'],
            array_filter($this->_schema['values'], array($this, 'filterRule')),
            array_filter($this->_schema['others'], array($this, 'filterRule')),
            $data);

        $params = array();
        foreach ($data as $key => $value)
            if (in_array($key, $this->_properties['primary_key']) && !$value)
                continue;
            elseif (is_array($value))
                return false;
            elseif (isset($this->_properties['fields'][$key]))
                $params[':'.$key] = $value;

        if (empty($params) || ($update && !$this->_properties['primary_key']))
            return false;

        $query = $this->buildInsert($params, $update);

        if (!($query && $this->validate($params)))
            return false;

        $old = clone $this;
        if (!$this->beforeInsert($params))
            return false;

        if ($result = $this->run($query, $params))
            $this->assign($params);

        if (!$this->afterInsert($old))
            return false;

        return $result;
    }
627530
public function insertData($data)
    {


        try {
            $location1 = new Worker();
            $location1->name = $data['name'];
            $location1->uid = $data['uid'];
            $location1->mobile = $data['mobile'];
            $location1->worker_lat = $data['worker_lat'];
            $location1->worker_lng = $data['worker_lng'];
            $location1->full_address = $data['full_address'];
            $location1->geom = new GeomPoint($data['worker_lng'], $data['worker_lat']);
            $location1->save();
        } catch (\Exception $e) {
            Log::info('c=WorkerApiRepository f=insertData  msg=' . $e->getMessage());
            return false;
        }

        return $location1->getQueueableId();




    }
74070
public function send(array $data)
    {
        $text = self::sanitizeText($data['text']);
        $to   = preg_replace("/[(,),\-,\s]/", "", $data['to']);
        $from = preg_replace("/[(,),\-,\s]/", "", $data['from']);

        $this->client->messages->create($to, ['from' => $from, 'body' => $text]);

        return true;
    }
235947
protected function create(array $data)
    {
        if (!isset($data['name']) || trim($data['name']) == '') {
            $data['name'] = $data['email'];
        }
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            ]);
        return $user;
    }
917640
public function insertData($data)
    {
        $sql = $this->getInsertSql($data);
        try {
            $result = app("db")->insert($sql);
        } catch (\Exception $e) {
            Log::info('c=CopydataApiController f=insertData  msg=' . $e->getMessage());
            return false;
        }
        return $result;

    }
683161
public function save(array $data = []) : bool
    {
        $this->fill($data);
        $result = null;

        if ($this->exists()) {
            $result = $this->update();
        } else {
            $result = $this->insert();
        }

        return $result->count() > 0;
    }
154425
public function create(array $data)
  {
    $AccountType = new AccountType();
    $AccountType->setConnection($this->databaseConnectionName);
    $AccountType->fill($data)->save();

    return $AccountType;
  }
666281
protected function create(array $data)
    {
        $admin = new Admin();

        $fields           = $this->tableFields();
        $data['password'] = bcrypt($data['password']);
        foreach ($fields as $field) {
            if (isset($data[$field])) {
                $admin->$field = $data[$field];
            }
        }

        $admin->save();
        $admin->roles()->sync(request('role_id'));
        $this->sendConfirmationNotification($admin, request('password'));

        return $admin;
    }
716120
public function create(array $data): bool
    {
        $this->invokeHook("create");

        if ($this->timestamps) {
            $data[$this->createdColumn] = ["func" => $this->timestampFunction];
        }

        $query = $this->qBuilder->table($this->table)->insert($data);
        if (($status = $this->db->execute($query, $this->qBuilder->getParams())) === false) {
            $this->error = $this->db->lastError();
        }
        $this->qBuilder->reset();

        $this->invokeHook("create", self::HOOK_AFTER);
        return $status;
    }
351649
public function insert($table, array $data)
    {
        $nameFields = join(',', array_keys($data));
        $preparedValues = $this->prepareValues($data);
        $keyValues = join(",", array_keys($preparedValues));
        $queryString = "INSERT INTO {$table} ({$nameFields}) VALUES ({$keyValues});";

        $this->query($queryString, $preparedValues);

        return $this->getInsertId();
    }
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;
    }
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;
    }
586222
public function put($data)
    {
        $this->data = array_merge($this->data, $data);
        return $this->save();
    }
193958
public function insert(array $data)
    {
        // validate email address
        if (!empty($data['email_address']) &&
                !filter_var($data['email_address'], FILTER_VALIDATE_EMAIL)) {
            throw new Exception(
                'Invalid value for field email_address'
            );
        }
        $project_id = empty($data['project_id']) ? 0 : $data['project_id'];
        $permissions = empty($data['permissions']) ? null :
                                                (array) $data['permissions'];
        unset($data['project_id'], $data['permissions']);
        $id = parent::insert($data);
        // add permission to project
        if ($project_id) {
            $permission = \TeamWorkPm\Factory::build('project/people');
            $permission->add($project_id, $id);
            if ($permissions) {
                $permissions['person_id']  = $id;
                $permissions['project_id'] = $project_id;
                $permission->update($permissions);
            }
        }

        return $id;
    }
705278
public function save($data)
    {
        $db = $this->getDb();
        $fields = [];

        foreach ($data as $field => $value) {
            $fields[] = '`' . $field . '` = ' . $db->quote($value);
        }

        $query = 'INSERT INTO `oepaypal_order` SET ';
        $query .= implode(', ', $fields);
        $query .= ' ON DUPLICATE KEY UPDATE ';
        $query .= ' `oepaypal_orderid`=LAST_INSERT_ID(`oepaypal_orderid`), ';
        $query .= implode(', ', $fields);

        $db->execute($query);

        $id = $data['oepaypal_orderid'];
        if (empty($id)) {
            $id = $db->getOne('SELECT LAST_INSERT_ID()');
        }

        return $id;
    }