<?php

namespace App\Controllers\User;

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

class Data extends BaseController
{
    protected $dataModel;
    protected $wilayahModel;


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

    public function index()
    {
        $data = [
            'title' => 'Data Pendukung',

            'data_bencana' => $this->dataModel
                ->orderBy('tahun', 'DESC')
                ->findAll(),

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

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