public function insert($query, array $bindings=[], $returnLastInsertId=null)
    {
        $returnLastInsertId = $returnLastInsertId !== null
                              ? $returnLastInsertId
                              : $this->getOption(static::RETURN_LAST_ID);


        $this->callBeforeListeners('insert',[$query, $bindings]);

        $result = $bindings ? $this->runPrepared($query, $bindings)
                            : $this->writeUnprepared($query);

        $this->callBeforeListeners('insert',[$query, $bindings]);

        return $returnLastInsertId ? $this->lastInsertId() : null;
    }
public function insert($query, array $bindings=[], $returnLastInsertId=null)
    {
        $returnLastInsertId = $returnLastInsertId !== null
                              ? $returnLastInsertId
                              : $this->getOption(static::RETURN_LAST_ID);


        $this->callBeforeListeners('insert',[$query, $bindings]);

        $result = $bindings ? $this->runPrepared($query, $bindings)
                            : $this->writeUnprepared($query);

        $this->callBeforeListeners('insert',[$query, $bindings]);

        return $returnLastInsertId ? $this->lastInsertId() : null;
    }
public function insert ( $ query , array $ bindings = [ ] , $ returnLastInsertId = null ) { $ returnLastInsertId = $ returnLastInsertId !== null ? $ returnLastInsertId : $ this -> getOption ( static :: RETURN_LAST_ID ) ; $ this -> callBeforeListeners ( 'insert' , [ $ query , $ bindings ] ) ; $ result = $ bindings ? $ this -> runPrepared ( $ query , $ bindings ) : $ this -> writeUnprepared ( $ query ) ; $ this -> callBeforeListeners ( 'insert' , [ $ query , $ bindings ] ) ; return $ returnLastInsertId ? $ this -> lastInsertId ( ) : null ; }
Run an insert statement.

@param string|\Ems\Contracts\Stringable $query
@param array                            $bindings (optional)
@param bool                             $returnLastInsertId (optional)

@return int (last inserted id)
Run an insert statement .