Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Bug fix hook_after_add $id null #1256
Browse files Browse the repository at this point in the history
Also child issue
  • Loading branch information
fherryfherry authored Sep 6, 2018
1 parent 6b2533e commit 55787af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/CBController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ public function postAddSave()
$this->hook_before_add($this->arr);

// $this->arr[$this->primary_key] = $id = CRUDBooster::newId($this->table); //error on sql server
DB::table($this->table)->insert($this->arr);
$lastInsertId = $id = DB::table($this->table)->insertGetId($this->arr);

//Looping Data Input Again After Insert
foreach ($this->data_inputan as $ro) {
Expand Down Expand Up @@ -1216,7 +1216,7 @@ public function postAddSave()
}
}

$this->hook_after_add($this->arr[$this->primary_key]);
$this->hook_after_add($lastInsertId);

$this->return_url = ($this->return_url) ? $this->return_url : Request::get('return_url');

Expand Down

0 comments on commit 55787af

Please sign in to comment.