- Removido README.md padrão do Laravel (backend) - Removidos scripts de deploy (não mais necessários) - Atualizado copilot-instructions.md para novo fluxo - Adicionada documentação de auditoria do servidor - Sincronizado código de produção com repositório Novo workflow: - Trabalhamos diretamente em /root/webmoney (symlink para /var/www/webmoney) - Mudanças PHP são instantâneas - Mudanças React requerem 'npm run build' - Commit após validação funcional
42 lines
939 B
PHP
Executable File
42 lines
939 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class UserPreference extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'notify_due_payments',
|
|
'notify_due_payments_time',
|
|
'notify_due_payments_email',
|
|
'language',
|
|
'timezone',
|
|
'currency',
|
|
];
|
|
|
|
protected $casts = [
|
|
'notify_due_payments' => 'boolean',
|
|
// notify_due_payments_time is stored as TIME in DB, no cast needed
|
|
];
|
|
|
|
/**
|
|
* Get the user that owns the preferences.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the email to send notifications to.
|
|
* Falls back to user's email if not set.
|
|
*/
|
|
public function getNotificationEmail(): string
|
|
{
|
|
return $this->notify_due_payments_email ?? $this->user->email;
|
|
}
|
|
}
|