the_mechanic/app/Models/ServiceModel.php

28 lines
869 B
PHP
Executable File

<?php
namespace App\Models;
use CodeIgniter\Model;
class ServiceModel extends Model
{
protected $table = 'services';
protected $primaryKey = 'service_id';
protected $allowedFields = ['service_id','branch_id','category','service_name','labour_cost','cgst','sgst','price','tax','labour_cost_with_cost','description','makes_id','models_id','product_id','sub_service_id','isactive','cubic_capacity_id'];
public function getTax()
{
// Get a database instance
$db = \Config\Database::connect();
// Query the tax table
$query = $db->table('tax')->get();
// Check if query returned results
if ($query->resultID->num_rows > 0) {
return $query->getResultArray();
} else {
return []; // Return an empty array if no tax data found
}
}
}
?>