From fe0765795aae52df0edf064ce4add55d6edb0ed9 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Wed, 19 Jul 2023 01:58:32 +0100 Subject: [PATCH] Update table names to new format --- app/Http/Controllers/GuestbookController.php | 4 ++-- resources/views/pages/admin/guestbook.blade.php | 6 +++++- resources/views/pages/bookmarks.blade.php | 4 ++-- resources/views/pages/guestbook.blade.php | 6 +++++- routes/web.php | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/GuestbookController.php b/app/Http/Controllers/GuestbookController.php index 12b1c7f..c7aa88e 100644 --- a/app/Http/Controllers/GuestbookController.php +++ b/app/Http/Controllers/GuestbookController.php @@ -16,13 +16,13 @@ public function guestbookPost(Request $request) { 'message' => 'required' ]); - $matching_bans = DB::select('SELECT reason FROM guestbook_bans WHERE ip_address = ?', array($request->ip())); + $matching_bans = DB::select('SELECT reason FROM guestbook__bans WHERE ip_address = ?', array($request->ip())); if (count($matching_bans) > 0 ) { return view('errors.guestbook-ipban')->with('reason', $matching_bans[0]->reason); } - DB::insert('INSERT INTO guestbook_entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array( + DB::insert('INSERT INTO guestbook__entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array( htmlspecialchars($request->get('name')), time(), $request->ip(), diff --git a/resources/views/pages/admin/guestbook.blade.php b/resources/views/pages/admin/guestbook.blade.php index 56323ef..ec870bb 100644 --- a/resources/views/pages/admin/guestbook.blade.php +++ b/resources/views/pages/admin/guestbook.blade.php @@ -2,7 +2,11 @@ @section('title', 'guestbook') @section('content') @php - $entries = DB::select('SELECT id, name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); + $entries = DB::select(' + SELECT id, name, timestamp, message + FROM guestbook__entries + ORDER BY id DESC + '); @endphp

Entries ({{ count($entries) }} total)

@foreach ($entries as $entry) diff --git a/resources/views/pages/bookmarks.blade.php b/resources/views/pages/bookmarks.blade.php index 16d07cc..ee91334 100644 --- a/resources/views/pages/bookmarks.blade.php +++ b/resources/views/pages/bookmarks.blade.php @@ -5,7 +5,7 @@ @php $categories = DB::select(' SELECT id, name - FROM bookmark_categories + FROM bookmark__categories ORDER BY priority ASC '); @endphp @@ -15,7 +15,7 @@ @php $sites = DB::select(' SELECT name, url, description - FROM bookmark_sites + FROM bookmark__sites WHERE category_id = ? ORDER BY priority ASC ', array($category->id)); @endphp diff --git a/resources/views/pages/guestbook.blade.php b/resources/views/pages/guestbook.blade.php index 1690274..56991aa 100644 --- a/resources/views/pages/guestbook.blade.php +++ b/resources/views/pages/guestbook.blade.php @@ -43,7 +43,11 @@
@php - $entries = DB::select('SELECT name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); + $entries = DB::select(' + SELECT name, timestamp, message + FROM guestbook__entries + ORDER BY id DES + '); @endphp

Entries ({{ count($entries) }} total)

@foreach ($entries as $entry) diff --git a/routes/web.php b/routes/web.php index 7284bc3..36e9d70 100644 --- a/routes/web.php +++ b/routes/web.php @@ -60,7 +60,7 @@ } $id = request()->input('id'); - $entry = DB::table('guestbook_entries')->find($id); + $entry = DB::table('guestbook__entries')->find($id); if ($entry) { // Render a confirmation view @@ -78,7 +78,7 @@ } $id = request()->input('id'); - DB::table('guestbook_entries')->where('id', $id)->delete(); + DB::table('guestbook__entries')->where('id', $id)->delete(); return back()->with('success', 'Entry deleted successfully!'); });