blob: 5ebf451e56cdd06c8900ff82bb9fc174e503d5c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
namespace App\Http\Controllers;
use App\Models\GuestbookEntry;
use Illuminate\Support\Facades\DB;
use Illuminate\View\View;
use UAParser\Parser;
class AdminGuestbookController extends Controller
{
function getGuestbookUniqueAddr(): int {
$uniqueIpsCount = DB::table('guestbook__entries')->distinct()->count('ip');
return $uniqueIpsCount;
}
function getGuestbookEntriesCount(): int {
$entryCount = DB::table('guestbook__entries')->count();
return $entryCount;
}
public function show() : View {
$guestbook_unique_addr = $this->getGuestbookUniqueAddr();
$guestbook_entry_count = $this->getGuestbookEntriesCount();
$entries = GuestbookEntry::selectEntries();
$parser = Parser::create();
return view('admin.guestbook', [
'guestbook_unique_addr' => $guestbook_unique_addr,
'guestbook_entry_count' => $guestbook_entry_count,
'entries' => $entries,
'parser' => $parser,
]);
}
}
|