コード例 #1
0
ファイル: Builder.php プロジェクト: darrengopower/framework
 /**
  * @param array $values
  * @return bool
  */
 public function insert(array $values)
 {
     if (empty($values)) {
         return true;
     }
     if (!is_array(reset($values))) {
         $values = [$values];
     } else {
         foreach ($values as $key => $value) {
             ksort($value);
             $values[$key] = $value;
         }
     }
     $bindings = [];
     foreach ($values as $record) {
         foreach ($record as $value) {
             $bindings[] = $value;
         }
     }
     $sql = $this->grammar->compileInsert($this, $values);
     $bindings = $this->cleanBindings($bindings);
     return $this->connection->insert($sql, $bindings);
 }