Created
July 29, 2023 21:57
-
-
Save vihugarcia/ef71229e1951f32a6649bc3e819265b3 to your computer and use it in GitHub Desktop.
Chapter 11 Patient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\models; | |
use SimpleMVC\core\Model as Model; | |
class Patient extends Model { | |
public $id; | |
private $firstname; | |
private $lastname; | |
private $birthdate; | |
private $gender; | |
private $bloodtype; | |
private $phone; | |
private $email; | |
private $address; | |
public function __construct(string $table) | |
{ | |
$this->table = $table; | |
parent::__construct($this->table, $this->db); | |
$this->key = 'id'; | |
} | |
public function setFirstName($firstName) | |
{ | |
$this->firstname = $firstName; | |
} | |
public function setLastName($lastName) | |
{ | |
$this->lastname = $lastName; | |
} | |
public function setGender($gender) | |
{ | |
$this->gender = $gender; | |
} | |
public function setBirthdate($birthdate) | |
{ | |
$this->birthdate = $birthdate; | |
} | |
public function setBloodtype($bloodtype) | |
{ | |
$this->bloodtype = $bloodtype; | |
} | |
public function setPhone($phone) | |
{ | |
$this->phone = $phone; | |
} | |
public function setEmail($email) | |
{ | |
$this->email = $email; | |
} | |
public function setAddress($address) | |
{ | |
$this->address = $address; | |
} | |
public function getFirstName() | |
{ | |
return $this->firstname; | |
} | |
public function getLastName() | |
{ | |
return $this->lastname; | |
} | |
public function getBirthdate() | |
{ | |
return $this->birthdate; | |
} | |
public function getGender() | |
{ | |
return $this->gender; | |
} | |
public function getBloodtype() | |
{ | |
return $this->bloodtype; | |
} | |
public function getPhone() | |
{ | |
return $this->phone; | |
} | |
public function getEmail() | |
{ | |
return $this->email; | |
} | |
public function getAddress() | |
{ | |
return $this->address; | |
} | |
public function getAge() | |
{ | |
return date('Y') - date('Y', strtotime($this->birthdate)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment