update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
Executable → Regular
+1 -3
View File
@@ -11,7 +11,7 @@ class AdditionalCharge extends BaseModel
protected $table = 'additional_charges';
// CI useTimestamps = false
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'parent_id',
@@ -25,8 +25,6 @@ class AdditionalCharge extends BaseModel
'due_date',
'status',
'created_by',
'created_at',
'updated_at',
];
protected $casts = [
+1 -1
View File
@@ -9,7 +9,7 @@ class AttendanceCommentTemplate extends BaseModel
protected $table = 'attendance_comment_template';
// CI: useTimestamps = false
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'min_score',
Executable → Regular
+2 -2
View File
@@ -9,17 +9,17 @@ use Illuminate\Support\Facades\DB;
class AttendanceData extends BaseModel
{
protected $table = 'attendance_data';
public $timestamps = true; // uses created_at / updated_at
protected $fillable = [
'class_id',
'class_section_id',
'student_id',
'school_id',
'student_id',
'date',
'status',
'reason',
'reported',
'is_reported',
'is_notified',
'semester',
Executable → Regular
+5 -1
View File
@@ -13,12 +13,16 @@ class AttendanceDay extends BaseModel
// ✅ You are storing created_at / updated_at manually in CI (timestamps off there)
// User didn't explicitly ask to auto-manage here, so we keep it OFF to match CI.
// If you want auto-manage, tell me and Ill flip it.
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'class_section_id',
'date',
'status',
'draft',
'submitted',
'published',
'finalized',
'submitted_by',
'submitted_at',
'published_by',
+1 -1
View File
@@ -9,7 +9,7 @@ class AttendanceEmailTemplate extends BaseModel
protected $table = 'email_templates';
// ✅ Laravel will auto-manage created_at / updated_at
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'code',
Executable → Regular
View File
+1 -3
View File
@@ -18,13 +18,11 @@ class AttendanceTracking extends BaseModel
'date',
'is_reported',
'reason',
'note',
'is_notified',
'notif_counter',
'semester',
'school_year',
'created_at',
'updated_at',
'note',
];
protected $casts = [
Executable → Regular
-1
View File
@@ -17,7 +17,6 @@ class AuthorizedUser extends BaseModel
'firstname',
'lastname',
'phone_number',
'gender',
'email',
'relation_to_user',
'token',
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+1 -2
View File
@@ -9,13 +9,12 @@ class ClassPrepAdjustment extends BaseModel
protected $table = 'class_prep_adjustments';
// CI model didn't use timestamps; keep off unless your table has updated_at/created_at auto-managed.
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'class_section_id',
'item_name',
'adjustment',
'adjustable',
'school_year',
'created_at',
];
+1 -1
View File
@@ -9,7 +9,7 @@ class ClassPreparationLog extends BaseModel
protected $table = 'class_preparation_log';
// CI: useTimestamps = false
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'class_section_id',
-3
View File
@@ -20,7 +20,6 @@ class ClassProgressReport extends BaseModel
'week_end',
'subject',
'unit_title',
'materials',
'covered',
'homework',
'assessment',
@@ -31,8 +30,6 @@ class ClassProgressReport extends BaseModel
'support_needed',
'flags_json',
'attachment_path',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
-2
View File
@@ -21,8 +21,6 @@ class ClassSection extends BaseModel
'class_section_name',
'created_at',
'updated_at',
'semester',
'school_year',
];
protected $casts = [
+1 -1
View File
@@ -9,7 +9,7 @@ class CommunicationLog extends BaseModel
protected $table = 'communication_logs';
// CI model didn't enable timestamps; keep off unless your table has created_at/updated_at.
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'student_id',
+1 -4
View File
@@ -26,13 +26,10 @@ class Competition extends BaseModel
'prize_per_point',
'is_published',
'published_at',
'created_by',
'created_at',
'updated_at',
'deleted_at',
'is_locked',
'locked_at',
'locked_by',
'created_by',
];
protected $casts = [
+1 -4
View File
@@ -15,8 +15,6 @@ class CompetitionClassWinner extends BaseModel
'competition_id',
'class_section_id',
'winners_override',
'created_at',
'updated_at',
'question_count',
'prize_1',
'prize_2',
@@ -30,8 +28,7 @@ class CompetitionClassWinner extends BaseModel
'competition_id' => 'integer',
'class_section_id' => 'integer',
'question_count' => 'integer',
// If winners_override is JSON in DB, cast to array:
'winners_override' => 'array',
'winners_override' => 'integer',
];
/* Optional relationships */
-2
View File
@@ -17,8 +17,6 @@ class CompetitionScore extends BaseModel
'class_section_id',
'score',
'notes',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
+1 -1
View File
@@ -10,7 +10,7 @@ class Configuration extends BaseModel
protected $table = 'configuration';
// CI model didn't use timestamps
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'config_key',
Executable → Regular
+2 -2
View File
@@ -16,10 +16,10 @@ class ContactUs extends BaseModel
'reciever_id',
'subject',
'message',
'created_at',
'updated_at',
'semester',
'school_year',
'created_at',
'updated_at',
];
protected $casts = [
-1
View File
@@ -7,7 +7,6 @@ use App\Models\BaseModel;
class CurrentIncident extends BaseModel
{
protected $table = 'current_incident';
public $timestamps = true;
protected $fillable = [
Executable → Regular
+3 -6
View File
@@ -15,15 +15,12 @@ class DiscountUsage extends BaseModel
protected $fillable = [
'voucher_id',
'invoice_id',
'parent_id',
'discount_amount',
'description',
'school_year',
'updated_by',
'used_at',
'created_at',
'updated_at',
'semester',
'updated_by',
'parent_id',
'used_at',
];
protected $casts = [
Executable → Regular
+3 -3
View File
@@ -16,17 +16,17 @@ class DiscountVoucher extends BaseModel
protected $fillable = [
'code',
'discount_type',
'description',
'discount_value',
'max_uses',
'times_used',
'valid_from',
'valid_until',
'semester',
'school_year',
'is_active',
'description',
'created_at',
'updated_at',
'school_year',
'semester',
];
protected $casts = [
-2
View File
@@ -20,8 +20,6 @@ class EarlyDismissalSignature extends BaseModel
'mime_type',
'file_size',
'uploaded_by',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
+4 -6
View File
@@ -9,16 +9,14 @@ class EmailTemplate extends BaseModel
protected $table = 'email_templates';
// CI model didn't specify timestamps; keep off unless your table has created_at/updated_at.
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'code',
'variant',
'template_key',
'name',
'subject',
'body_html',
'body',
'is_active',
'updated_by',
'updated_at',
];
protected $casts = [
Executable → Regular
+1 -1
View File
@@ -12,8 +12,8 @@ class EmergencyContact extends BaseModel
public $timestamps = true;
protected $fillable = [
'emergency_contact_name',
'parent_id',
'emergency_contact_name',
'cellphone',
'email',
'relation',
Executable → Regular
+1 -1
View File
@@ -16,13 +16,13 @@ class Enrollment extends BaseModel
'student_id',
'class_section_id',
'parent_id',
'school_year',
'enrollment_date',
'enrollment_status',
'withdrawal_date',
'is_withdrawn',
'admission_status',
'semester',
'school_year',
'created_at',
'updated_at',
];
Executable → Regular
View File
Executable → Regular
+12
View File
@@ -18,8 +18,20 @@ class EventCharges extends BaseModel
'student_id',
'participation',
'charged',
'waiver_signed',
'event_paid',
'event_payment_id',
'class_section_id',
'external_firstname',
'external_lastname',
'external_note',
'external_parent_firstname',
'external_parent_lastname',
'external_parent_phone',
'external_parent_email',
'semester',
'school_year',
'created_by',
'updated_by',
'created_at',
'updated_at',
+2 -2
View File
@@ -15,12 +15,12 @@ class Exam extends BaseModel
*
* We'll keep auto created_at, no updated_at:
*/
public $timestamps = false;
public $timestamps = true;
const UPDATED_AT = null; // ✅ no updated_at column
protected $fillable = [
'student_id',
'student_school_id',
'school_id',
'class_section_id',
'exam_name',
'created_at',
+10 -3
View File
@@ -13,16 +13,26 @@ class ExamDraft extends BaseModel
protected $fillable = [
'teacher_id',
'author_id',
'class_section_id',
'semester',
'school_year',
'exam_type',
'draft_title',
'author_comment',
'description',
'teacher_file',
'teacher_filename',
'author_file',
'author_filename',
'status',
'acceptance_type',
'review_revision',
'reviewer_id',
'admin_id',
'is_legacy',
'reviewer_comment',
'reviewer_comments',
'admin_comments',
'reviewed_at',
'final_file',
@@ -30,9 +40,6 @@ class ExamDraft extends BaseModel
'final_pdf_file',
'version',
'previous_draft_id',
'is_legacy',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
+3 -5
View File
@@ -18,18 +18,16 @@ class Expense extends BaseModel
'receipt_path',
'description',
'retailor',
'purchased_by',
'date_of_purchase',
'purchased_by',
'added_by',
'created_at',
'updated_at',
'school_year',
'semester',
'status',
'status_reason',
'updated_by',
'approved_by',
'reimbursement_id',
'approved_by',
'updated_by',
];
protected $casts = [
-2
View File
@@ -24,8 +24,6 @@ class Family extends BaseModel
'preferred_lang',
'preferred_contact_method',
'is_active',
'created_at',
'updated_at',
];
protected $casts = [
-2
View File
@@ -17,8 +17,6 @@ class FamilyCommPref extends BaseModel
'via_email',
'via_sms',
'cc_all_guardians',
'created_at',
'updated_at',
];
protected $casts = [
-2
View File
@@ -19,8 +19,6 @@ class FamilyGuardian extends BaseModel
'receive_emails',
'receive_sms',
'custody_notes',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
-2
View File
@@ -17,8 +17,6 @@ class FamilyStudent extends BaseModel
'student_id',
'is_primary_home',
'notes',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
+2 -1
View File
@@ -12,7 +12,7 @@ class FinalExam extends BaseModel
* CI: useTimestamps = false (even though table has created_at/updated_at fields).
* So we keep timestamps OFF and you can set created_at/updated_at manually if needed.
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
@@ -20,6 +20,7 @@ class FinalExam extends BaseModel
'class_section_id',
'updated_by',
'score',
'comment',
'semester',
'school_year',
'created_at',
Executable → Regular
+2 -2
View File
@@ -16,14 +16,14 @@ class FinalScore extends BaseModel
'student_id',
'school_id',
'class_section_id',
'updated_by',
'teacher_id',
'score',
'score_letter',
'comment',
'semester',
'school_year',
'created_at',
'updated_at',
'semester',
];
protected $casts = [
Executable → Regular
+1 -1
View File
@@ -13,7 +13,7 @@ class Homework extends BaseModel
* CI: useTimestamps = false (even though created_at/updated_at columns exist).
* Keep it OFF to match behavior. If you want Laravel to auto-manage, tell me.
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
Executable → Regular
+4 -6
View File
@@ -17,10 +17,6 @@ class InventoryItem extends BaseModel
'name',
'description',
'quantity',
'good_qty',
'needs_repair_qty',
'need_replace_qty',
'cannot_find_qty',
'unit',
'condition',
'isbn',
@@ -30,8 +26,10 @@ class InventoryItem extends BaseModel
'semester',
'school_year',
'updated_by',
'created_at',
'updated_at',
'good_qty',
'needs_repair_qty',
'need_replace_qty',
'cannot_find_qty',
];
protected $casts = [
-2
View File
@@ -23,8 +23,6 @@ class InventoryMovement extends BaseModel
'teacher_id',
'student_id',
'class_section_id',
'created_at',
'updated_at',
];
protected $casts = [
Executable → Regular
+3 -3
View File
@@ -14,12 +14,14 @@ class Invoice extends BaseModel
* CI: useTimestamps = false because DB defaults/triggers manage created_at/updated_at.
* In Laravel, keep timestamps OFF and let DB handle them.
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'parent_id',
'invoice_number',
'total_amount',
'school_year',
'semester',
'balance',
'paid_amount',
'has_discount',
@@ -27,11 +29,9 @@ class Invoice extends BaseModel
'due_date',
'status',
'description',
'school_year',
'created_at',
'updated_at',
'updated_by',
'semester',
];
protected $casts = [
Executable → Regular
View File
+1 -1
View File
@@ -19,9 +19,9 @@ class InvoiceStudentList extends BaseModel
'school_id',
'enrolled',
'school_year',
'semester',
'created_at',
'updated_at',
'semester',
];
protected $casts = [
Executable → Regular
+2 -4
View File
@@ -15,11 +15,9 @@ class IpAttempt extends BaseModel
'ip_address',
'attempts',
'last_attempt_at',
'blocked_until',
'created_at',
'updated_at',
'school_year',
'semester',
'school_year',
'blocked_until',
];
protected $casts = [
Executable → Regular
View File
Executable → Regular
+2 -2
View File
@@ -18,10 +18,10 @@ class LoginActivity extends BaseModel
'logout_time',
'ip_address',
'user_agent',
'school_year',
'semester',
'created_at',
'updated_at',
'semester',
'school_year',
];
protected $casts = [
Executable → Regular
+2 -3
View File
@@ -16,11 +16,10 @@ class ManualPayment extends BaseModel
'amount',
'payment_method',
'reference',
'discount_number',
'proof_path',
'created_at',
'school_year',
'semester',
'school_year',
'created_at',
];
protected $casts = [
+1 -1
View File
@@ -12,7 +12,7 @@ class MidtermExam extends BaseModel
* CI: useTimestamps = false (even though created_at/updated_at columns exist).
* Keep it OFF to match behavior (you can still store created_at/updated_at manually).
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
-4
View File
@@ -11,7 +11,6 @@ class NavItem extends BaseModel
// ✅ CI: timestamps + soft deletes
use SoftDeletes;
public $timestamps = true;
protected $fillable = [
@@ -22,9 +21,6 @@ class NavItem extends BaseModel
'target',
'sort_order',
'is_enabled',
'created_at',
'updated_at',
'deleted_at',
];
protected $casts = [
+2 -8
View File
@@ -11,7 +11,6 @@ class Notification extends BaseModel
// ✅ CI: soft deletes + timestamps
use SoftDeletes;
public $timestamps = true;
protected $fillable = [
@@ -23,14 +22,9 @@ class Notification extends BaseModel
'status',
'action_url',
'attachment_path',
'scheduled_at',
'sent_at',
'expires_at',
'created_at',
'updated_at',
'deleted_at',
'school_year',
'semester',
'school_year',
'scheduled_at',
];
protected $casts = [
+6 -3
View File
@@ -24,8 +24,6 @@ class ParentAttendanceReport extends BaseModel
'semester',
'school_year',
'status',
'created_at',
'updated_at',
];
protected $casts = [
@@ -61,10 +59,15 @@ class ParentAttendanceReport extends BaseModel
?string $startDate = null,
?string $endDate = null,
?string $schoolYear = null,
?string $semester = null
?string $semester = null,
?int $parentId = null,
): array {
$q = DB::table('parent_attendance_reports as par');
if ($parentId !== null && $parentId > 0) {
$q->where('par.parent_id', $parentId);
}
if (!empty($startDate)) {
$q->where('par.report_date', '>=', $startDate);
}
-2
View File
@@ -24,8 +24,6 @@ class ParentMeetingSchedule extends BaseModel
'school_year',
'status',
'created_by',
'created_at',
'updated_at',
];
protected $casts = [
-3
View File
@@ -18,11 +18,8 @@ class ParentModel extends BaseModel
'secondparent_email',
'secondparent_phone',
'firstparent_id',
'secondparent_id',
'semester',
'school_year',
'created_at',
'updated_at',
];
protected $casts = [
-2
View File
@@ -22,8 +22,6 @@ class ParentNotification extends BaseModel
'response',
'semester',
'school_year',
'created_at',
'updated_at',
];
protected $casts = [
+1 -1
View File
@@ -12,7 +12,7 @@ class Participation extends BaseModel
* CI: useTimestamps = false (even though created_at/updated_at columns exist).
* Keep OFF to match behavior (you can still set created_at/updated_at manually).
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
+1 -1
View File
@@ -20,7 +20,7 @@ class PasswordReset extends BaseModel
* This will auto-set expires_at whenever you call save()/update().
* (Only do this if thats truly what you want.)
*/
public $timestamps = false;
public $timestamps = true;
const CREATED_AT = 'created_at';
const UPDATED_AT = 'expires_at';
+1 -1
View File
@@ -9,7 +9,7 @@ class PasswordResetRequest extends BaseModel
protected $table = 'password_reset_requests';
// CI: timestamps off
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'ip_address',
+3 -2
View File
@@ -12,7 +12,7 @@ class PayPalPayment extends BaseModel
* CI: created_at is managed, updated_at is NOT used.
* In Laravel: enable timestamps but disable UPDATED_AT.
*/
public $timestamps = false;
public $timestamps = true;
const UPDATED_AT = null;
protected $fillable = [
@@ -31,8 +31,9 @@ class PayPalPayment extends BaseModel
'summary',
'raw_payload',
'synced',
'semester',
'school_year',
'sync_attempts',
'created_at',
];
protected $casts = [
+2 -4
View File
@@ -13,7 +13,7 @@ class Payment extends BaseModel
* CI: useTimestamps = false because DB handles created_at/updated_at (defaults/triggers).
* Keep OFF in Laravel too.
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'parent_id',
@@ -27,12 +27,10 @@ class Payment extends BaseModel
'check_number',
'payment_method',
'payment_date',
'semester',
'school_year',
'semester',
'status',
'updated_by',
'created_at',
'updated_at',
];
protected $casts = [
+2 -2
View File
@@ -19,10 +19,10 @@ class PaymentError extends BaseModel
'wrong_payment_method',
'wrong_check_file',
'error_note',
'semester',
'school_year',
'logged_at',
'logged_by',
'school_year',
'semester',
];
protected $casts = [
+5 -3
View File
@@ -10,7 +10,7 @@ class PaymentTransaction extends BaseModel
protected $table = 'payment_transactions';
// ✅ CI: useTimestamps = true (created_at/updated_at)
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'transaction_id',
@@ -21,9 +21,11 @@ class PaymentTransaction extends BaseModel
'payment_status',
'transaction_fee',
'payment_reference',
'is_full_payment',
'school_year',
'semester',
'school_year',
'is_full_payment',
'created_at',
'updated_at',
];
protected $casts = [
+2 -4
View File
@@ -23,11 +23,9 @@ class PaypalTransaction extends BaseModel
'status',
'payment_method',
'transaction_fee',
'raw_data',
'created_at',
'updated_at',
'school_year',
'semester',
'school_year',
'raw_data',
];
protected $casts = [
+9 -2
View File
@@ -13,15 +13,22 @@ class Preferences extends BaseModel
protected $fillable = [
'user_id',
'notification_email',
'notification_sms',
'receive_email_notifications',
'receive_sms_notifications',
'theme',
'language',
'timezone',
'style_color',
'menu_color',
'custom',
'menu_custom_bg',
'menu_custom_text',
'menu_custom_mode',
'receive_push_notifications',
'daily_summary_email',
'privacy_mode',
'marketing_emails',
'account_activity_alerts',
'created_at',
'updated_at',
];
-2
View File
@@ -21,8 +21,6 @@ class PrintRequest extends BaseModel
'required_by',
'pickup_method',
'status',
'created_at',
'updated_at',
];
protected $casts = [
-1
View File
@@ -22,7 +22,6 @@ class PromotionQueue extends BaseModel
'updated_at',
'updated_by',
];
public $timestamps = true;
protected $casts = [
-1
View File
@@ -25,7 +25,6 @@ class PurchaseOrder extends BaseModel
'total',
'notes',
];
public $timestamps = true;
protected $casts = [
-1
View File
@@ -17,7 +17,6 @@ class PurchaseOrderItem extends BaseModel
'received_qty',
'unit_cost',
];
public $timestamps = true;
protected $casts = [
+1 -2
View File
@@ -8,8 +8,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Quiz extends BaseModel
{
protected $table = 'quiz';
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
+2 -4
View File
@@ -23,16 +23,14 @@ class Refund extends BaseModel
'refund_paid_amount',
'request',
'note',
'semester',
'school_year',
'approved_by',
'updated_by',
'refund_method',
'check_nbr',
'check_file',
'created_at',
'updated_at',
'semester',
];
public $timestamps = true;
protected $casts = [
+1 -3
View File
@@ -11,16 +11,14 @@ class Reimbursement extends BaseModel
protected $table = 'reimbursements';
protected $fillable = [
'expense_id',
'amount',
'reimbursed_to',
'approved_by',
'receipt_path',
'description',
'status',
'expense_id',
'added_by',
'created_at',
'updated_at',
'school_year',
'semester',
'check_number',
+3 -3
View File
@@ -18,15 +18,15 @@ class ReimbursementBatch extends BaseModel
protected $fillable = [
'title',
'yearly_batch_number',
'status',
'school_year',
'semester',
'created_by',
'closed_by',
'opened_at',
'closed_at',
'notes',
'school_year',
'semester',
'yearly_batch_number',
];
protected $casts = [
-1
View File
@@ -22,7 +22,6 @@ class ReportCardAcknowledgement extends BaseModel
'created_at',
'updated_at',
];
public $timestamps = true;
protected $casts = [
-1
View File
@@ -19,7 +19,6 @@ class Role extends BaseModel
'created_at',
'updated_at',
];
public $timestamps = true;
protected $casts = [
-3
View File
@@ -9,14 +9,11 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class RoleNavItem extends BaseModel
{
protected $table = 'role_nav_items';
public $timestamps = true;
protected $fillable = [
'role_id',
'nav_item_id',
'created_at',
'updated_at',
];
protected $casts = [
-1
View File
@@ -22,7 +22,6 @@ class RolePermission extends BaseModel
'created_at',
'updated_at',
];
public $timestamps = true;
protected $casts = [
+1 -1
View File
@@ -14,7 +14,7 @@ class ScoreComment extends BaseModel
* CI: timestamps disabled (created_at handled by DB default).
* Keep disabled in Laravel too.
*/
public $timestamps = false;
public $timestamps = true;
/**
* If your DB uses created_at as default timestamp and you want Laravel
+2 -2
View File
@@ -13,11 +13,11 @@ class Section extends BaseModel
protected $fillable = [
'section_name',
'description',
'created_at',
'updated_at',
'updated_by',
];
public $timestamps = false;
public $timestamps = true;
protected $casts = [
'updated_by' => 'integer',
-2
View File
@@ -27,8 +27,6 @@ class SemesterScore extends BaseModel
'semester_score',
'semester',
'school_year',
'created_at',
'updated_at',
];
/**
-1
View File
@@ -17,7 +17,6 @@ class Setting extends BaseModel
'created_at',
'updated_at',
];
public $timestamps = true;
protected $casts = [
+4 -3
View File
@@ -13,19 +13,20 @@ class Staff extends BaseModel
/**
* CI: timestamps managed manually (created_at/updated_at set by caller/controller)
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'user_id',
'firstname',
'lastname',
'email',
'phone',
'role_name',
'school_year',
'active_role',
'status',
'school_year',
'created_at',
'updated_at',
'user_id',
];
protected $casts = [
+3 -1
View File
@@ -10,7 +10,6 @@ use Illuminate\Support\Facades\DB;
class StaffAttendance extends BaseModel
{
protected $table = 'staff_attendance';
public $timestamps = true;
/**
@@ -28,6 +27,9 @@ class StaffAttendance extends BaseModel
'semester',
'school_year',
'status',
'present',
'absent',
'late',
'reason',
'created_at',
'updated_at',
+4 -5
View File
@@ -26,17 +26,16 @@ class Student extends BaseModel
'dob',
'age',
'gender',
'is_active',
'registration_grade',
'is_new',
'photo_consent',
'is_new',
'parent_id',
'school_year',
'registration_date',
'tuition_paid',
'rfid_tag',
'semester',
'year_of_registration',
'school_year',
'rfid_tag',
'is_active',
];
protected $casts = [
+1 -1
View File
@@ -13,7 +13,7 @@ class StudentAllergy extends BaseModel
/**
* CI: timestamps disabled
*/
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'student_id',
+4 -5
View File
@@ -13,16 +13,15 @@ class StudentClass extends BaseModel
protected $fillable = [
'student_id',
'school_id',
'class_section_id',
'is_event_only',
'semester',
'school_year',
'is_event_only',
'description',
'created_at',
'updated_at',
'updated_by',
'updated_at',
'created_at',
];
public $timestamps = true;
protected $casts = [
+1 -1
View File
@@ -13,7 +13,7 @@ class StudentMedicalCondition extends BaseModel
/**
* CI: timestamps disabled
*/
public $timestamps = false;
public $timestamps = true;
protected $fillable = [
'student_id',
-1
View File
@@ -19,7 +19,6 @@ class SubjectCurriculum extends BaseModel
'created_at',
'updated_at',
];
public $timestamps = true;
protected $casts = [
-1
View File
@@ -7,7 +7,6 @@ use App\Models\BaseModel;
class Supplier extends BaseModel
{
protected $table = 'suppliers';
public $timestamps = true;
protected $fillable = [
-1
View File
@@ -7,7 +7,6 @@ use App\Models\BaseModel;
class SupplyCategory extends BaseModel
{
protected $table = 'supply_categories';
public $timestamps = true;
protected $fillable = [
-1
View File
@@ -7,7 +7,6 @@ use App\Models\BaseModel;
class SupportRequest extends BaseModel
{
protected $table = 'support_requests';
public $timestamps = true;
protected $fillable = [
+4 -7
View File
@@ -12,17 +12,14 @@ class TeacherClass extends BaseModel
protected $table = 'teacher_class';
protected $fillable = [
'class_section_id',
'teacher_id',
'position',
'semester',
'class_section_id',
'school_year',
'description',
'created_at',
'updated_at',
'position',
'updated_by',
'updated_at',
'created_at',
];
public $timestamps = true;
protected $casts = [
+36 -15
View File
@@ -18,12 +18,15 @@ class User extends Authenticatable implements JWTSubject
use HasApiTokens;
use HasFactory;
public $timestamps = true;
protected $table = 'users';
protected $fillable = [
'school_id',
'firstname',
'password',
'account_id',
'lastname',
'firstname',
'gender',
'cellphone',
'email',
@@ -33,20 +36,19 @@ class User extends Authenticatable implements JWTSubject
'state',
'zip',
'accept_school_policy',
'is_verified',
'status',
'is_suspended',
'failed_attempts',
'password',
'created_at',
'updated_at',
'token',
'account_id',
'user_type',
'rfid_tag',
'school_id',
'failed_attempts',
'last_failed_at',
'semester',
'school_year',
'rfid_tag',
'last_failed_at',
'status',
'is_suspended',
'is_verified',
'token',
'updated_at',
'created_at',
];
protected $hidden = [
@@ -71,9 +73,28 @@ class User extends Authenticatable implements JWTSubject
return $this->getKey();
}
public function getJWTCustomClaims()
public function getJWTCustomClaims(): array
{
return [];
return [
'name' => trim(($this->firstname ?? '').' '.($this->lastname ?? '')),
'roles' => $this->roleNamesLikeCodeIgniter(),
];
}
/**
* Role names joined from `user_roles` + `roles`, matching CodeIgniter `AuthController::apiLogin` (no roles.is_active filter).
*
* @return list<string>
*/
public function roleNamesLikeCodeIgniter(): array
{
return DB::table('user_roles')
->join('roles', 'roles.id', '=', 'user_roles.role_id')
->where('user_roles.user_id', $this->id)
->pluck('roles.name')
->unique()
->values()
->all();
}
/* ============================================================
-2
View File
@@ -21,8 +21,6 @@ class UserNotification extends BaseModel
'is_read',
'delivered',
'delivered_at',
'school_year',
'semester',
];
protected $casts = [
+5 -1
View File
@@ -10,6 +10,8 @@ use Illuminate\Support\Facades\DB;
class UserRole extends BaseModel
{
public $timestamps = true;
use SoftDeletes;
protected $table = 'user_roles';
@@ -17,10 +19,12 @@ class UserRole extends BaseModel
protected $fillable = [
'user_id',
'role_id',
'semester',
'school_year',
'created_at',
'updated_at',
'deleted_at',
'updated_by',
'deleted_at',
];
protected $casts = [
-3
View File
@@ -16,10 +16,7 @@ class WhatsappGroupLink extends BaseModel
'semester',
'invite_link',
'active',
'created_at',
'updated_at',
];
public $timestamps = true; // requires created_at/updated_at
protected $casts = [

Some files were not shown because too many files have changed in this diff Show More