Пример #1
0
 protected function create($force_id = false)
 {
     $this->beforeCreate();
     $data = $this->data;
     if (is_array($this->id_field)) {
         foreach ($this->id_field as $kk => $vv) {
             $data[$vv] = $this->id[$kk];
         }
         DB::insert($this->table, $data);
     } elseif ($force_id) {
         $data[$this->id_field] = $this->id;
         DB::insert($this->table, $data);
     } else {
         $this->id = DB::insert($this->table, $data);
     }
     return $this->id ? $this->afterCreate() : false;
 }