diff options
author | Freya Murphy <freya@freyacat.org> | 2024-12-23 11:13:27 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-12-23 11:13:27 -0500 |
commit | 5a2ba9c2e7605bb788bc406184547d22c6436867 (patch) | |
tree | cbd988d534e8a8593a31d70571222443f80da0b3 /src/web/_model/home.php | |
parent | fix about modal (diff) | |
download | xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.gz xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.bz2 xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.zip |
v2.1.0, refactor w/ crimson
Diffstat (limited to 'src/web/_model/home.php')
-rw-r--r-- | src/web/_model/home.php | 17 |
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; + } +} |