<?php
namespace App\Controllers;

use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Shield\Entities\User;
use App\Libraries\GeneralLib;

class Tipepangkalan extends BaseController
{
    use ResponseTrait;

    public function select_tipe()
    {
        if (!auth()->loggedIn()) {
            return $this->fail(['message'=>'error'],400,null,'error');
        }

        $user = auth()->user();

        $jsonArray = json_decode(file_get_contents('php://input'), true);
        $search = "";
        $page = "1";
        if (isset($jsonArray['search'])) {
            $search = $jsonArray['search'];
        }
        if (isset($jsonArray['page'])) {
            $page = $jsonArray['page'];
        }

        $tmodel = model('TipepangkalanModel');
        $temp = $tmodel->GetSelect($search, $page);

        return $this->respond($temp,200);
    }
}
?>