46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class Receipt_model extends Model
|
|
{
|
|
protected $table = 'receipts';
|
|
protected $primaryKey = 'receipt_id';
|
|
|
|
protected $allowedFields = ['receipt_no', 'date','donor_id','amount', 'mode_of_receipt','receipt_details','cause_name', 'remarks'];
|
|
|
|
|
|
|
|
function all_receipt()
|
|
{
|
|
|
|
$builder = $this->db->table('receipts');
|
|
$result = $builder->get();
|
|
$output = $result->getResultArray();
|
|
return $output;
|
|
}
|
|
|
|
function last_receipt()
|
|
{
|
|
|
|
$builder=$this->db->query("SELECT receipt_id,receipt_no,date,donor_id,amount,mode_of_receipt,receipt_details,cause_name,remarks FROM receipts where receipt_id =(select max(receipt_id) from receipts) ");
|
|
$output = $builder->getResultArray();
|
|
|
|
return $output;
|
|
}
|
|
|
|
|
|
// protected $returnType = 'array';
|
|
// protected $useSoftDeletes = true;
|
|
|
|
|
|
|
|
// protected $useTimestamps = false;
|
|
// protected $createdField = 'created_at';
|
|
// protected $updatedField = 'updated_at';
|
|
// protected $deletedField = 'deleted_at';
|
|
|
|
// protected $validationRules = [];
|
|
// protected $validationMessages = [];
|
|
// protected $skipValidation = false;
|
|
} |