47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
namespace App\Controllers\Api;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
use App\Controllers\BaseController;
|
|
use App\Models\ZonesModel;
|
|
|
|
class ZonesApi extends BaseController {
|
|
use ResponseTrait;
|
|
|
|
protected $model;
|
|
|
|
public function __construct() {
|
|
$this->model = new ZonesModel();
|
|
}
|
|
|
|
public function getAll() {
|
|
$rows = $this->model->getAll();
|
|
|
|
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
|
|
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
|
}
|
|
|
|
// public function getProvinces() {
|
|
// // $filters = [
|
|
// // 'zoneid' => $this->request->getVar('zoneid') ?? null,
|
|
// // 'zonename' => $this->request->getVar('zonename') ?? null
|
|
// // ];
|
|
|
|
// $rows = $this->model->getAllProvinces();
|
|
|
|
// if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
|
|
// return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
|
// }
|
|
|
|
// public function getCities() {
|
|
|
|
// $filter = [
|
|
// 'zoneid' => $this->request->getVar('zoneid') ?? null
|
|
// ];
|
|
|
|
// $rows = $this->model->getAllCities($filter);
|
|
|
|
// if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
|
|
// return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
|
// }
|
|
} |