reconstruction of the project
This commit is contained in:
@@ -6,10 +6,11 @@ use App\Models\BaseModel;
|
||||
|
||||
class Preferences extends BaseModel
|
||||
{
|
||||
protected $table = 'user_preferences'; // Adjusted to match the table name
|
||||
protected $primaryKey = 'id'; // Primary key of the table
|
||||
protected $table = 'user_preferences';
|
||||
|
||||
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
||||
public $timestamps = true;
|
||||
|
||||
// Allowed fields to enable mass assignment
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'notification_email',
|
||||
@@ -25,8 +26,21 @@ class Preferences extends BaseModel
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
// Enable automatic timestamp management if needed
|
||||
public $timestamps = true;
|
||||
const CREATED_AT = 'created_at';
|
||||
const UPDATED_AT = 'updated_at';
|
||||
protected $casts = [
|
||||
'user_id' => 'integer',
|
||||
|
||||
'receive_email_notifications' => 'boolean',
|
||||
'receive_sms_notifications' => 'boolean',
|
||||
'receive_push_notifications' => 'boolean',
|
||||
'daily_summary_email' => 'boolean',
|
||||
'privacy_mode' => 'boolean',
|
||||
'marketing_emails' => 'boolean',
|
||||
'account_activity_alerts' => 'boolean',
|
||||
];
|
||||
|
||||
/* Optional relationship */
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user