donation/app/Models/UsersModel.php

23 lines
700 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class UsersModel extends Model
{
protected $table = 'users';
protected $primaryKey = 'user_id';
protected $allowedFields = ['user_id','user_name','email','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','created_by','updated_by'];
public function saveData($data, $id = null)
{
if ($id === null) {
// Insert new record
return $this->insert($data);
} else {
// Update existing record
return $this->update($id, $data);
}
}
}