Update besar apk finance
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class InvoiceModel extends CI_Model
|
||||
{
|
||||
public function find($id)
|
||||
{
|
||||
return $this->db->get_where('invoices', array('id' => (int) $id))->row();
|
||||
}
|
||||
|
||||
public function createDraft(array $data)
|
||||
{
|
||||
$data['status'] = 'draft';
|
||||
if (!$this->db->insert('invoices', $data)) {
|
||||
throw new RuntimeException('Gagal membuat draft invoice.');
|
||||
}
|
||||
return (int) $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function updateById($id, array $data)
|
||||
{
|
||||
return $this->db->where('id', (int) $id)->update('invoices', $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user