public function getByName($name)
{
try {
$data = $this->db->fetchRow("SELECT * FROM users WHERE `type` = ? AND `name` = ?", [$this->model->getType(), $name]);
if ($data["id"]) {
$this->assignVariablesToModel($data);
} else {
throw new \Exception("user doesn't exist");
}
} catch (\Exception $e) {
throw $e;
}
}