• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / auth / 22527357078

28 Feb 2026 07:22PM UTC coverage: 63.267% (+0.7%) from 62.568%
22527357078

push

github

daycry
Remove PHP 8.1 from PHPUnit CI matrix

Update .github/workflows/phpunit.yml to drop PHP 8.1 from the test matrix. CI will now run PHPUnit only on PHP 8.2 and 8.3, reducing the matrix to current supported versions.

3064 of 4843 relevant lines covered (63.27%)

41.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Controllers/Admin/LogsController.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Auth\Controllers\Admin;
15

16
use CodeIgniter\HTTP\RedirectResponse;
17
use CodeIgniter\I18n\Time;
18
use Daycry\Auth\Models\LoginModel;
19

20
/**
21
 * Admin Logs Controller — view and purge login attempt logs.
22
 */
23
class LogsController extends BaseAdminController
24
{
25
    /**
26
     * Paginated login log with optional filters.
27
     */
28
    public function index(): string
×
29
    {
30
        /** @var LoginModel $loginModel */
31
        $loginModel = model(LoginModel::class);
×
32

33
        $q       = (string) $this->request->getGet('q');       // identifier / email
×
34
        $success = $this->request->getGet('success');           // '1' | '0' | ''
×
35
        $from    = (string) $this->request->getGet('from');     // Y-m-d
×
36
        $to      = (string) $this->request->getGet('to');       // Y-m-d
×
37

38
        if ($q !== '') {
×
39
            $loginModel->like('identifier', $q);
×
40
        }
41

42
        if ($success === '1' || $success === '0') {
×
43
            $loginModel->where('success', (int) $success);
×
44
        }
45

46
        if ($from !== '') {
×
47
            $loginModel->where('date >=', $from . ' 00:00:00');
×
48
        }
49

50
        if ($to !== '') {
×
51
            $loginModel->where('date <=', $to . ' 23:59:59');
×
52
        }
53

54
        $logs = $loginModel
×
55
            ->orderBy('id', 'DESC')
×
56
            ->paginate(30, 'default');
×
57

58
        return $this->view('Daycry\\Auth\\Views\\admin\\logs\\index', [
×
59
            'logs'    => $logs,
×
60
            'pager'   => $loginModel->pager,
×
61
            'q'       => $q,
×
62
            'success' => $success,
×
63
            'from'    => $from,
×
64
            'to'      => $to,
×
65
        ]);
×
66
    }
67

68
    /**
69
     * Delete login records older than N days.
70
     */
71
    public function purge(): RedirectResponse
×
72
    {
73
        $days = max(1, (int) $this->request->getPost('days'));
×
74

75
        /** @var LoginModel $loginModel */
76
        $loginModel = model(LoginModel::class);
×
77

78
        $cutoff = Time::now()->subDays($days)->format('Y-m-d H:i:s');
×
79
        $loginModel->where('date <', $cutoff)->delete();
×
80

81
        return redirect()->route('admin-logs')
×
82
            ->with('message', "Logs older than {$days} day(s) have been purged.");
×
83
    }
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc