We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d47d9f5 commit 57b0d6bCopy full SHA for 57b0d6b
src/Model.php
@@ -5,15 +5,22 @@ abstract class Model extends PHPRed
5
{
6
public $model;
7
public $table;
8
+ public $primaryKey;
9
10
public function __construct(\mysqli $mysqli)
11
12
parent::__construct($mysqli);
13
}
14
- public function getAll()
15
+ public function getAll() : array
16
17
$query = "SELECT * FROM $this->table;";
18
return $this->query($query);
19
20
+
21
+ public function getById(int $modelId) : array
22
+ {
23
+ $query = "SELECT * FROM $this->table WHERE $this->primaryKey = $modelId;";
24
+ return $this->query($query);
25
+ }
26
0 commit comments