<?php
  class Install extends Controller {
        private InstallModel $installModel; // ✅ پہلے declare کریں

    public function __construct(){

      $this->installModel = $this->model('InstallModel');

     
    }
    public function index(){
        $this->view('install/install');
    }
    public function dashboard(){
      echo json_encode("working fine...");
    }

    public function databaseConnect(){

    

      $input['db_name'] = $_POST['data'][0] ?? null;
      $input['db_username'] = $_POST['data'][1] ?? null;
      $input['db_password'] = $_POST['data'][2] ?? null;
      $input['base_url'] = $_POST['data'][3] ?? null;
     $databse_install =   $this->installModel->addDatabse($input);

     if($databse_install != "databse error"){
        $databse_install =  $this->installModel->databaseInstall();
     }
      echo json_encode($databse_install);

     }


  }