<?php
// app/Models/DepartmentModel.php

namespace App\Models;
use CodeIgniter\Model;

class GalleryModel extends Model
{
    protected $table = 'gallery';
    protected $primaryKey = 'id';

    protected $allowedFields = [
        'id', 'department_id', 'type', 'file', 'created_at','created_by','row_status'
    ];

    public function getGalleryWithDepartment()
    {
        return $this->db->table('gallery')
            ->select('gallery.*, department.department_name')
            ->join('department', 'department.id = gallery.department_id', 'left') 
            ->where('gallery.row_status', 1)
            ->get()
            ->getResultArray();
    }
}

?>