fic(voucher): convert string kosong ke null
This commit is contained in:
parent
a97d99d58d
commit
bd57eada37
@ -125,6 +125,12 @@ public function store()
|
||||
|
||||
$data = $this->prepareSavedData();
|
||||
|
||||
foreach (['min_purchase', 'max_discount', 'quota', 'limit_per_user'] as $field) {
|
||||
if ($this->$field === '') {
|
||||
$this->$field = null;
|
||||
}
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($data) {
|
||||
$voucher = Voucher::create($data);
|
||||
|
||||
@ -137,6 +143,7 @@ public function update()
|
||||
$this->validate();
|
||||
|
||||
$data = $this->prepareSavedData();
|
||||
|
||||
DB::transaction(function () use ($data) {
|
||||
unset($data['available_count']);
|
||||
$this->voucher->update($data);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user