diff --git a/src/app/Models/Worker.php b/src/app/Models/Worker.php index 1afe1cc5..3a1095f0 100644 --- a/src/app/Models/Worker.php +++ b/src/app/Models/Worker.php @@ -31,7 +31,11 @@ public function __construct($data = []) public static function getAll() { $query = "SELECT * FROM workers"; - return Database::prepareAndExecute($query); + $results = Database::prepareAndExecute($query); + foreach ($results as $key => $value) { + $results[$key] = new self($value); + } + return $results; } // Static method to find a worker by ID @@ -99,6 +103,41 @@ public function getId() return $this->id; } + public function getCompany() + { + return $this->company; + } + + public function getName() + { + return $this->name; + } + + public function getDni() + { + return $this->dni; + } + + public function getPassword() + { + return $this->password; + } + + public function getEmail() + { + return $this->email; + } + + public function getRoleId() + { + return $this->role_id; + } + + public function setId($id) + { + $this->id = $id; + } + public function setCompany($company) { $this->company = $company; diff --git a/src/app/Views/Home.php b/src/app/Views/Home.php index d65e5fb3..67d4d2ab 100755 --- a/src/app/Views/Home.php +++ b/src/app/Views/Home.php @@ -8,21 +8,17 @@ DNI Email Role ID - Created At - Updated At - - - - - - - - + getId(); ?> + getCompany(); ?> + getName(); ?> + getDni(); ?> + getEmail(); ?> + getRoleId(); ?> diff --git a/src/routes/web.php b/src/routes/web.php index fbf45ecd..18648278 100755 --- a/src/routes/web.php +++ b/src/routes/web.php @@ -26,5 +26,9 @@ "controller" => AuthController::class, "method" => "index" ], + "/exemple" => [ + "controller" => HomeController::class, + "method" => "exemple" + ], ], ]; \ No newline at end of file