<?php

namespace App\Controllers;

use App\Models\RewarderLedgerModel;

class RewarderLedgers extends AdminBaseController
{
    public $title = 'Ledger';
    public $menu = 'rewarder';
    public $submenu = 'rewarder_ledgers';

    public function index()
    {
        $this->permissionCheck('user_wallet_view');

        $rows = db_connect()->table('rewarder_ledger l')
            ->select('l.*, u.name as user_name, u.username as user_username, u.email as user_email, sh.name as shop_name')
            ->join('users u', 'u.id = l.user_id', 'left')
            ->join('rewarder_shops sh', 'sh.id = l.shop_id', 'left')
            ->orderBy('l.id', 'desc')
            ->get()
            ->getResult();

        return view('admin/rewarder/ledgers/list', compact('rows'));
    }
}

