remove codeigniter

This commit is contained in:
root
2026-06-04 02:41:08 -04:00
parent 4e33882ac7
commit b4e6ac03c5
180 changed files with 457 additions and 2186 deletions
+18 -18
View File
@@ -77,16 +77,16 @@ class User extends Authenticatable implements JWTSubject
{
return [
'name' => trim(($this->firstname ?? '').' '.($this->lastname ?? '')),
'roles' => $this->roleNamesLikeCodeIgniter(),
'roles' => $this->roleNames(),
];
}
/**
* Role names joined from `user_roles` + `roles`, matching CodeIgniter `AuthController::apiLogin` (no roles.is_active filter).
* Role names joined from `user_roles` + `roles` without filtering inactive roles.
*
* @return list<string>
*/
public function roleNamesLikeCodeIgniter(): array
public function roleNames(): array
{
return DB::table('user_roles')
->join('roles', 'roles.id', '=', 'user_roles.role_id')
@@ -111,7 +111,7 @@ class User extends Authenticatable implements JWTSubject
$roles = array_map(
static fn ($role) => strtolower(trim((string) $role)),
$this->roleNamesLikeCodeIgniter(),
$this->roleNames(),
);
$isTeacherScoped = in_array('teacher', $roles, true)
@@ -256,9 +256,9 @@ class User extends Authenticatable implements JWTSubject
*/
/**
* CI: getUsersWithRoles($sort='id',$order='asc')
* legacy: getUsersWithRoles($sort='id',$order='asc')
* Returns rows: users.id, firstname, lastname, email, roles.name as role
* NOTE: If user has multiple roles, this will return multiple rows (same as CI join).
* NOTE: If user has multiple roles, this will return multiple rows (same as legacy join).
*/
public static function getUsersWithRoles(string $sort = 'users.id', string $order = 'asc'): array
{
@@ -284,7 +284,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getUnverifiedUsers() created more than 2 minutes ago
* legacy: getUnverifiedUsers() created more than 2 minutes ago
*/
public static function getUnverifiedUsers(): array
{
@@ -296,7 +296,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: findAll($limit,$offset,$sort,$order,$conditions)
* legacy: findAll($limit,$offset,$sort,$order,$conditions)
* Laravel version: returns array of rows.
*/
public static function findAllCustom(
@@ -331,7 +331,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getUserRole($user_id) -> string|null
* legacy: getUserRole($user_id) -> string|null
* Returns one role name (MIN for stability).
*/
public static function getUserRoleName(int $userId): ?string
@@ -346,7 +346,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getAllUsers($sort,$order)
* legacy: getAllUsers($sort,$order)
*/
public static function getAllUsers(string $sort = 'users.id', string $order = 'asc')
{
@@ -355,7 +355,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getUserInfoById($userId) but safe fields (exclude password/token/is_verified)
* legacy: getUserInfoById($userId) but safe fields (exclude password/token/is_verified)
* Returns array with roles.
*/
public static function getUserInfoById(int $userId): ?array
@@ -388,7 +388,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getUsersByRole($roleName)
* legacy: getUsersByRole($roleName)
*/
public static function getUsersByRole(string $roleName): array
{
@@ -404,7 +404,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getUsersByRoleAndSchoolYear($roleName, $schoolYear)
* legacy: getUsersByRoleAndSchoolYear($roleName, $schoolYear)
*/
public static function getUsersByRoleAndSchoolYear(string $roleName, string $schoolYear): array
{
@@ -421,7 +421,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: countAdminsBySchoolYear($schoolYear)
* legacy: countAdminsBySchoolYear($schoolYear)
* Excludes guest/teacher/teacher_assistant/parent.
*/
public static function countAdminsBySchoolYear(string $schoolYear): int
@@ -447,7 +447,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getParents()
* legacy: getParents()
* Finds role "parent" case-insensitively then returns grouped users.
*/
public static function getParents(): array
@@ -470,7 +470,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getTeacher($user_id) -> teacher_first/teacher_last or null
* legacy: getTeacher($user_id) -> teacher_first/teacher_last or null
*/
public static function getTeacherNameParts(int $userId): ?array
{
@@ -496,7 +496,7 @@ class User extends Authenticatable implements JWTSubject
}
/**
* CI: getNoParentUsersWithRole(...) (as close as possible)
* legacy: getNoParentUsersWithRole(...) (as close as possible)
* Returns: id, firstname, lastname, email, roles (comma string)
*/
public static function getNoParentUsersWithRole(
@@ -628,7 +628,7 @@ class User extends Authenticatable implements JWTSubject
* TeacherModel: getTeachersWithAssignments()
* Reads config_key=current_school_year and returns current_class + school_year.
*
* NOTE: your CI code joins class_section via classSection.id.
* NOTE: your legacy code joins class_section via classSection.id.
* Here I join teacher_class.class_section_id => class_section.id to match that snippet.
* If your real section table is classSection (not class_section), change the join accordingly.
*/