Frankie B
0f52d80ca6
* Just commit it all * Require auth * crap * Update homepage * Block AI scrapers * Update cache update script * Add dummy file * Remove unnecessary lastfm config var * Use withQueryParameters for LastFM API * Fix embeds * Update example env * Smard
35 lines
1 KiB
PHP
35 lines
1 KiB
PHP
<?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,
|
|
]);
|
|
}
|
|
}
|