Files
alrahma_sunday_school/_chunk5.txt
T
root e81a1832ad
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Successful in 1m26s
fix home page display snd styling
2026-09-02 23:15:24 -04:00

40 lines
1016 B
Plaintext

public function index()
{
$data = [
'users' => $this->userModel->findAll(),
'roles' => $this->roleModel->findAll(),
];
return view('administrator/dashboard', $data);
}
public function isadministrator()
{
$session = session();
$allowedRoles = [
'administrator',
'admin',
'principal',
//'vice_principal',
//'vice principal',
];
$role = strtolower((string) $session->get('role'));
if ($role !== '' && in_array($role, $allowedRoles, true)) {
return true;
}
$roles = $session->get('roles');
if (is_array($roles)) {
foreach ($roles as $candidate) {
$candidate = strtolower((string) $candidate);
if ($candidate !== '' && in_array($candidate, $allowedRoles, true)) {
return true;
}
}
}
return false;
}