<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('/', static fn () => redirect()->to('/kas'));
$routes->get('login', 'Auth::login');
$routes->post('login', 'Auth::attempt');
$routes->get('logout', 'Auth::logout');

$routes->group('kas', ['filter' => 'auth'], static function ($routes) {
    $routes->get('', 'Kas::index');
    $routes->get('create', 'Kas::create');
    $routes->get('laporan', 'Kas::laporan');
    $routes->post('', 'Kas::store');
    $routes->get('(:num)/edit', 'Kas::edit/$1');
    $routes->post('(:num)', 'Kas::update/$1');
    $routes->post('(:num)/delete', 'Kas::delete/$1');
});
