58726ee0e9
API CI/CD / Validate (composer + pint) (push) Successful in 3m6s
API CI/CD / Test (PHPUnit) (push) Failing after 5m48s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 1m33s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
134 lines
3.1 KiB
PHP
134 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Support\SchoolYear;
|
|
|
|
final class SchoolYearTableRegistry
|
|
{
|
|
public const YEAR_SCOPED = [
|
|
'classes',
|
|
'classSection',
|
|
'sections',
|
|
'enrollments',
|
|
'student_class',
|
|
'teacher_class',
|
|
'attendance_data',
|
|
'attendance_day',
|
|
'attendance_record',
|
|
'attendance_tracking',
|
|
'class_progress_reports',
|
|
'exam_drafts',
|
|
'exams',
|
|
'final_exam',
|
|
'final_score',
|
|
'semester_scores',
|
|
'invoices',
|
|
'invoice_installments',
|
|
'payments',
|
|
'payment_transactions',
|
|
'manual_payments',
|
|
'expenses',
|
|
'refunds',
|
|
'calendar_events',
|
|
'events',
|
|
'parent_notifications',
|
|
'parent_meeting_schedules',
|
|
'print_requests',
|
|
'report_card_acknowledgements',
|
|
'whatsapp_group_links',
|
|
'whatsapp_group_memberships',
|
|
];
|
|
|
|
public const GLOBAL = [
|
|
'users',
|
|
'authorized_users',
|
|
'roles',
|
|
'permissions',
|
|
'role_permissions',
|
|
'user_roles',
|
|
'nav_items',
|
|
'role_nav_items',
|
|
'parent_accounts',
|
|
'settings',
|
|
'configuration',
|
|
'preferences',
|
|
'user_preferences',
|
|
'email_templates',
|
|
'school_years',
|
|
'migrations',
|
|
'laravel_migrations',
|
|
'cache',
|
|
'cache_locks',
|
|
'sessions',
|
|
'personal_access_tokens',
|
|
'password_resets',
|
|
'password_reset_requests',
|
|
];
|
|
|
|
public const IDENTITY_WITH_YEAR_RELATION = [
|
|
'families',
|
|
'parents',
|
|
'students',
|
|
'teachers',
|
|
'staff',
|
|
'family_guardians',
|
|
'family_students',
|
|
'emergency_contacts',
|
|
'student_allergies',
|
|
'student_medical_conditions',
|
|
];
|
|
|
|
public const CONTEXT = [
|
|
'audit_logs',
|
|
'communication_logs',
|
|
'notifications',
|
|
'notification_recipients',
|
|
'user_notifications',
|
|
'messages',
|
|
'support_requests',
|
|
'contactus',
|
|
'finance_notification_logs',
|
|
'payment_notification_logs',
|
|
];
|
|
|
|
public static function categoryFor(string $table): ?string
|
|
{
|
|
if (self::isYearScoped($table)) {
|
|
return 'year_scoped';
|
|
}
|
|
|
|
if (self::isGlobal($table)) {
|
|
return 'global';
|
|
}
|
|
|
|
if (self::isIdentityWithYearRelation($table)) {
|
|
return 'identity_with_year_relation';
|
|
}
|
|
|
|
if (self::isContext($table)) {
|
|
return 'context';
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public static function isYearScoped(string $table): bool
|
|
{
|
|
return in_array($table, self::YEAR_SCOPED, true);
|
|
}
|
|
|
|
public static function isGlobal(string $table): bool
|
|
{
|
|
return in_array($table, self::GLOBAL, true);
|
|
}
|
|
|
|
public static function isIdentityWithYearRelation(string $table): bool
|
|
{
|
|
return in_array($table, self::IDENTITY_WITH_YEAR_RELATION, true);
|
|
}
|
|
|
|
public static function isContext(string $table): bool
|
|
{
|
|
return in_array($table, self::CONTEXT, true);
|
|
}
|
|
}
|