<?php

namespace App\Controllers\Admin;

use App\Models\Magento\CommandeModel;

class TestMagento extends \App\Controllers\BaseController
{
    public function index()
    {
        $commandeModel = new CommandeModel();

        try {
            $total = $commandeModel->countTotal();
            $recent = $commandeModel->getRecent(5);
        } catch (\Throwable $e) {
            return $this->response->setJSON([
                'error' => $e->getMessage(),
            ]);
        }

        return $this->response->setJSON([
            'total_commandes' => $total,
            'recent' => $recent,
        ]);
    }
}
