Skip to content

Commit

Permalink
Fix table field
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhsan3adi committed Mar 13, 2023
1 parent e4e035c commit eee42a0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/Models/PetugasModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protected function initialize()
$this->allowedFields = [
'email',
'username',
'superadmin'
'is_superadmin'
];
}

Expand All @@ -35,7 +35,7 @@ public function savePetugas($idPetugas, $email, $username, $role)
$this->primaryKey => $idPetugas,
'email' => $email,
'username' => $username,
'superadmin' => $role ?? '0',
'is_superadmin' => $role ?? '0',
]);
}
}
4 changes: 2 additions & 2 deletions app/Views/admin/petugas/edit-data-petugas.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
<label for="role">Role</label>
<select class="custom-select <?= $validation->getError('role') ? 'is-invalid' : ''; ?>" id="role" name="role">
<option value="">--Pilih role--</option>
<option value="0" <?= old('role') ?? $oldInput['role'] ?? $data['superadmin'] == "0" ? 'selected' : ''; ?>>
<option value="0" <?= old('role') ?? $oldInput['role'] ?? $data['is_superadmin'] == "0" ? 'selected' : ''; ?>>
Petugas
</option>
<option value="1" <?= old('role') ?? $oldInput['role'] ?? $data['superadmin'] ?? '' == "1" ? 'selected' : ''; ?>>
<option value="1" <?= old('role') ?? $oldInput['role'] ?? $data['is_superadmin'] ?? '' == "1" ? 'selected' : ''; ?>>
Super Admin
</option>
</select>
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/petugas/list-data-petugas.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<td><?= $i; ?></td>
<td><?= $value['username']; ?></td>
<td><b><?= $value['email']; ?></b></td>
<td><?= $value['superadmin'] == '1' ? 'Super Admin' : 'Petugas'; ?></td>
<td><?= $value['is_superadmin'] == '1' ? 'Super Admin' : 'Petugas'; ?></td>
<td>
<?php if ($value['username'] == 'superadmin') : ?>
<button disabled class="btn btn-disabled p-2" id="<?= $value['username']; ?>">
Expand Down
2 changes: 1 addition & 1 deletion vendor/myth/auth/src/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,6 @@ public function getUsername()
*/
public function getRole()
{
return trim(trim($this->attributes['superadmin']));
return trim(trim($this->attributes['is_superadmin']));
}
}

0 comments on commit eee42a0

Please sign in to comment.