<?php

namespace App\Controllers\Api;

use App\Models\LogAktivitasModel;

class LogAktivitasController extends BaseApiController
{
    protected $log;

    public function __construct()
    {
        $this->log = new LogAktivitasModel();
    }

    // ======================
    // GET /api/log
    // ======================
    public function index()
    {
        $data = $this->log
            ->select('
                log_aktivitas.*,
                users.nama,
                users.username,
                users.role
            ')
            ->join('users', 'users.id_user = log_aktivitas.id_user', 'left')
            ->orderBy('log_aktivitas.waktu', 'DESC')
            ->findAll();

        return $this->respondSuccess($data, 'Data log aktivitas');
    }
}