fix home page display snd styling
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user