feat : visits table in admin dashboard

This commit is contained in:
2026-08-22 08:13:49 -07:00
parent 737e8a6b5c
commit 618a3d4cd9
3 changed files with 53 additions and 1 deletions
@@ -29,9 +29,11 @@ class DashboardController extends Controller
->orderBy('visit_date')
->get();
$recentVisits = Visit::orderByDesc('created_at')->paginate(15);
return view('admin.dashboard', compact('flightsCount', 'usersCount',
'bookingsCount', 'indexPageCont' , 'visits'));
'bookingsCount', 'indexPageCont' , 'visits' , 'recentVisits'));
}
+1
View File
@@ -59,6 +59,7 @@ return [
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'timezone' => '+03:30',
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
+49
View File
@@ -205,6 +205,55 @@
</div>
<div class="row mt-4">
<div class="col-xl-12">
<div class="card custom-card">
<div class="card-header">
<div class="card-title">
لیست بازدیدهای اخیر
</div>
</div>
<div class="card-body pt-0">
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th>تاریخ بازدید</th>
<th>ساعت</th>
<th>آدرس IP</th>
</tr>
</thead>
<tbody>
@forelse($recentVisits as $visit)
<tr>
<td>{{ verta($visit->created_at)->format('Y/m/d') }}</td>
<td>{{ verta($visit->created_at)->format('H:i') }}</td>
<td>{{ $visit->ip_address ?? '—' }}</td>
</tr>
@empty
<tr>
<td colspan="4" class="text-center">بازدیدی ثبت نشده است</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{ $recentVisits->links() }}
</div>
</div>
</div>
</div>
</div>