From 04fc009874db2d539ad881b649f7ebb512f05312 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Thu, 8 Aug 2024 22:22:38 +0100 Subject: Init rails app --- app/Models/GuestbookEntry.php | 50 ------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 app/Models/GuestbookEntry.php (limited to 'app/Models/GuestbookEntry.php') diff --git a/app/Models/GuestbookEntry.php b/app/Models/GuestbookEntry.php deleted file mode 100644 index f5e2de2..0000000 --- a/app/Models/GuestbookEntry.php +++ /dev/null @@ -1,50 +0,0 @@ -name = htmlspecialchars($request->get('name')); - $newEntry->message = htmlspecialchars($request->get('message')); - $newEntry->ip = $request->ip(); - $newEntry->agent = $request->userAgent(); - $newEntry->admin = auth()->check(); - $newEntry->save(); - } - - public static function selectEntries() { - $entries = GuestbookEntry::orderBy('created_at', 'desc')->get(); - return $entries; - } - - public static function importGuestbookEntry(array $data) { - foreach ($data as $entry) { - $dt = new \DateTime('@' . $entry['timestamp']); - $newEntry = new GuestbookEntry; - $newEntry->name = $entry['name']; - $newEntry->ip = $entry['ip_address']; - $newEntry->agent = $entry['agent']; - $newEntry->admin = $entry['site_owner']; - $newEntry->message = $entry['message']; - $newEntry->created_at = $dt; - $newEntry->updated_at = $dt; - $newEntry->save(); - } - } -} -- cgit v1.2.3-54-g00ecf