<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>Hello, world!</title>
</head>
<body>
<?php echo $__env->make('navbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<div class="row container mt-3">
    <div class="col-12 col-md-6 my-2 col-lg-4">
        <div class="card">
            <div class="card-header">
                Visits
            </div>
            <div class="card-body">
                <?php
                    $totalVisitors = \Shetabit\Visitor\Models\Visit::query()->distinct('ip')->count('ip');
                ?>
                <h4><?php echo e($totalVisitors); ?></h4>
            </div>
        </div>
    </div>
    <div class="col-12 col-md-6 my-2 col-lg-4">
        <div class="card">
            <div class="card-header">
                Humans
            </div>
            <?php
                $humans = \App\Models\RealVisit::query()->distinct('ip')->count('ip');
            ?>
            <div class="card-body">
                <h4><?php echo e($humans); ?></h4>
            </div>
        </div>
    </div>
    <div class="col-12 col-md-6 my-2 col-lg-4">
        <div class="card">
            <div class="card-header">
                Bots
            </div>
            <div class="card-body">
                <h4><?php echo e($totalVisitors-$humans); ?></h4>
            </div>
        </div>
    </div>
    <?php $__currentLoopData = \Shetabit\Visitor\Models\Visit::query()->distinct()->get(['platform']); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $platform): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="col-12 my-2 col-md-6 col-lg-4">
            <div class="card">
                <div class="card-header"><?php echo e($platform->platform); ?></div>
                <div class="card-body">
                    <h6><?php echo e(\Shetabit\Visitor\Models\Visit::query()->where('platform',$platform->platform)->distinct('ip')->count('ip')); ?></h6>
                </div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<div class="row container my-3 mx-3">
    <div class="col-12">
        <table class="table table-sm">
            <thead>
            <tr>
                <th scope="col">IP</th>
                <th scope="col">User Agent</th>
                <th scope="col">User Type</th>
                <th scope="col">Browser</th>
                <th scope="col">Platform</th>
                <th scope="col">Time</th>
            </tr>
            </thead>
            <tbody>
            <?php
                $visitors =  \Shetabit\Visitor\Models\Visit::query()->groupBy(['ip'])->latest()->limit(300)->paginate(20);

            ?>
            <?php $__currentLoopData = $visitors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $userType = (bool)\App\Models\RealVisit::where('ip',$data->ip)->count() ? '<span class="badge badge-success">Human</span>':'<span class="badge badge-danger">Bot</span>';
                ?>
                <tr>
                    <th scope="row"><?php echo e($data->ip); ?></th>
                    <td><?php echo $userType; ?></td>
                    <td><?php echo e($data->useragent); ?></td>
                    <td><?php echo e($data->browser); ?></td>
                    <td><?php echo e($data->platform); ?></td>
                    <td><?php echo e($data->created_at); ?></td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            </tbody>
        </table>
        <?php echo $visitors->render(); ?>

    </div>
</div>


<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.3/dist/umd/popper.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
</body>
</html>
<?php /**PATH /home/khoezsbi/public_html/resources/views/dashboard.blade.php ENDPATH**/ ?>