vb_book/app/Models/UsersModel.php
2024-10-29 15:37:48 +05:30

34 lines
981 B
PHP
Executable File

<?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','event_id','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);
}
}
public function getEventName()
{
return $this->db->table('events')
->select('events.*')
->get()
->getResult();
print_r($this->db->getLastQuery());die;
}
}