<?php

namespace App\Controllers\User;

use App\Controllers\BaseController;
use App\Models\WilayahModel;
use App\Models\PetaKerawananModel;

class Dashboard extends BaseController
{
    protected $wilayahModel;
    protected $petaModel;

    public function __construct()
    {
        $this->wilayahModel = new WilayahModel();
        $this->petaModel    = new PetaKerawananModel();
    }

    public function index()
    {

        $data['title'] = 'Dashboard User';

        $data['wilayah'] = $this->wilayahModel
            ->orderBy('nama_desa', 'ASC')
            ->findAll();

        // id_peta = 21 (Batas Desa)
        $data['peta'] = $this->petaModel->find(21);

        return view('user/dashboard', $data);
    }
}