22 lines
745 B
PHP
22 lines
745 B
PHP
<?php
|
|
namespace app\Models;
|
|
|
|
use PDO;
|
|
|
|
class EmployeeProfileModel extends Model {
|
|
|
|
public function getProfile($nationalId) {
|
|
$stmt = $this->db->prepare("SELECT * FROM employee_profiles WHERE national_id = ?");
|
|
$stmt->execute([$nationalId]);
|
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function saveProfile($nationalId, $bankName, $bankAccount) {
|
|
$sql = "INSERT INTO employee_profiles (national_id, bank_name, bank_account)
|
|
VALUES (?, ?, ?)
|
|
ON DUPLICATE KEY UPDATE bank_name = VALUES(bank_name), bank_account = VALUES(bank_account)";
|
|
$stmt = $this->db->prepare($sql);
|
|
return $stmt->execute([$nationalId, $bankName, $bankAccount]);
|
|
}
|
|
}
|