Files
alrahma_sunday_school/app/Models/ClassModel.php
T
2026-05-16 13:44:12 -04:00

46 lines
855 B
PHP
Executable File

<?php
namespace App\Models;
use CodeIgniter\Model;
class ClassModel extends Model
{
protected $table = 'classes'; // The table name
protected $primaryKey = 'id'; // The correct primary key for the classes table
protected $allowedFields = [
'class_name',
'schedule',
'capacity'
]; // Fields that are allowed to be manipulated
protected $useTimestamps = false;
public function getAllClasses()
{
return $this->findAll();
}
public function getClassById($id)
{
return $this->find($id);
}
public function createClass($data)
{
return $this->insert($data);
}
public function updateClass($id, $data)
{
return $this->update($id, $data);
}
public function deleteClass($id)
{
return $this->delete($id);
}
}
?>