diff --git a/src/Promocodes.php b/src/Promocodes.php index 84075c5..515fc23 100644 --- a/src/Promocodes.php +++ b/src/Promocodes.php @@ -140,8 +140,8 @@ public function save($amount = 1, $reward = null) $data = []; foreach ($this->generate($amount) as $key => $code) { - $data[]['code'] = $code; - $data[]['reward'] = $reward; + $data[$key]['code'] = $code; + $data[$key['reward'] = $reward; } // if insertion goes well @@ -185,7 +185,7 @@ public function apply($code, $hard_check = false) // if ($hard_check) { - return $row->reward; + return $record->reward; } else { return true; }