39 lines
1.8 KiB
PHP
39 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class PreferencesModel extends Model
|
|
{
|
|
protected $table = 'user_preferences'; // Adjusted to match the table name
|
|
protected $primaryKey = 'id'; // Primary key of the table
|
|
|
|
// Allowed fields to enable mass assignment
|
|
protected $allowedFields = [
|
|
'user_id', // Foreign key linking preferences to a user
|
|
'receive_email_notifications', // Email notifications preference
|
|
'receive_sms_notifications', // SMS notifications preference
|
|
'theme', // Theme preference (e.g., light or dark)
|
|
'language', // Language preference
|
|
'timezone', // Timezone preference
|
|
'style_color', // UI accent color key
|
|
'menu_color', // Menu palette key or 'custom'
|
|
'menu_custom_bg', // Custom menu background color
|
|
'menu_custom_text', // Custom menu text color
|
|
'menu_custom_mode', // Custom menu mode: light|dark
|
|
'receive_push_notifications', // Push notifications preference
|
|
'daily_summary_email', // Daily summary email preference
|
|
'privacy_mode', // Privacy mode setting
|
|
'marketing_emails', // Marketing emails preference
|
|
'account_activity_alerts', // Account activity alerts preference
|
|
'created_at', // Timestamp of when the record was created
|
|
'updated_at' // Timestamp of when the record was last updated
|
|
];
|
|
|
|
// Enable automatic timestamp management if needed
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'created_at';
|
|
protected $updatedField = 'updated_at';
|
|
}
|