summaryrefslogtreecommitdiff
path: root/src/web/_model/home.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/_model/home.php')
-rw-r--r--src/web/_model/home.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/web/_model/home.php b/src/web/_model/home.php
new file mode 100644
index 0000000..f4a33e0
--- /dev/null
+++ b/src/web/_model/home.php
@@ -0,0 +1,17 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+class Home_model extends XSS_Model {
+
+ private function get_posts(): ?array {
+ return $this->db()
+ ->select('*')
+ ->from('api.post')
+ ->limit(POST_PAGE_SIZE)
+ ->rows();
+ }
+
+ public function get_data(): ?array {
+ $data = parent::get_data();
+ $data['posts'] = $this->get_posts();
+ return $data;
+ }
+}