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

visavi / rotor / 26723576697

31 May 2026 08:27PM UTC coverage: 14.172% (-0.4%) from 14.618%
26723576697

push

github

visavi
Перенес файлы обновлений бд в отдельную папку

785 of 5539 relevant lines covered (14.17%)

1.26 hits per line

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

0.0
/app/Http/Controllers/CounterController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Http\Controllers;
6

7
use App\Models\Counter24;
8
use App\Models\Counter31;
9
use Illuminate\View\View;
10

11
class CounterController extends Controller
12
{
13
    /**
14
     * Главная страница
15
     */
16
    public function index(): View
×
17
    {
18
        $count = statsCounter();
×
19
        $online = statsOnline();
×
20

21
        $counts31 = [];
×
22
        $counters = Counter31::query()
×
23
            ->orderByDesc('period')
×
24
            ->limit(30)
×
25
            ->get()
×
26
            ->keyBy('period');
×
27

28
        for ($i = 0; $i < 30; $i++) {
×
29
            $curDate = date('Y-m-d 00:00:00', strtotime("-$i day", SITETIME));
×
30

31
            $cnt = $counters->get($curDate);
×
32

33
            $counts31['hits'][] = $cnt->hits ?? 0;
×
34
            $counts31['hosts'][] = $cnt->hosts ?? 0;
×
35
            $counts31['labels'][] = date('M j', strtotime($curDate));
×
36
        }
37

38
        $counts24 = [];
×
39
        $counters = Counter24::query()
×
40
            ->orderByDesc('period')
×
41
            ->limit(24)
×
42
            ->get()
×
43
            ->keyBy('period');
×
44

45
        for ($i = 0; $i < 24; $i++) {
×
46
            $curHour = date('Y-m-d H:00:00', strtotime("-$i hour", SITETIME));
×
47

48
            $cnt = $counters->get($curHour);
×
49

50
            $counts24['hits'][] = $cnt->hits ?? 0;
×
51
            $counts24['hosts'][] = $cnt->hosts ?? 0;
×
52
            $counts24['labels'][] = date('H', strtotime($curHour));
×
53
        }
54

55
        return view('counters/index', compact('count', 'online', 'counts24', 'counts31'));
×
56
    }
57
}
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