<?php

namespace App\Controllers\Mobile;

use App\Controllers\Mobile\BC;
use App\Models\Panel\MasterData\Pengumuman as MasterDataPengumuman;
use CodeIgniter\API\ResponseTrait;

class Pengumuman extends BC
{
    use ResponseTrait;
    public function index()
    {
        return view('Mobile/pengumuman', ['ft' => 'pengumuman']);
    }


    public function all()
    {
        if (!$this->request->isAJAX() && ENVIRONMENT != 'development') {
            exit('No direct script access allowed');
        }
        $data = (new MasterDataPengumuman())->where(['tujuan' => 2])->orderBy('created_at', 'DESC')->findAll();
        return $this->respond($data);
    }
}
