Subject contains UTF-8 codes sometimes

This commit is contained in:
Deon George 2021-08-26 22:32:32 +10:00
parent 403dde0d35
commit ba7f9c1c99
4 changed files with 20 additions and 4 deletions

View File

@ -16,7 +16,8 @@ class Echomail extends Model implements Packet
protected $collection = FALSE;
private const cast_utf8 = [
'msg'
'subject',
'msg',
];
protected $dates = ['datetime'];

View File

@ -9,13 +9,18 @@ use Jenssegers\Mongodb\Eloquent\SoftDeletes;
use App\Classes\FTN\Message;
use App\Interfaces\Packet;
use App\Traits\UseMongo;
use App\Traits\{EncodeUTF8,UseMongo};
final class Netmail extends Model implements Packet
{
private const LOGKEY = 'MN-';
use SoftDeletes,UseMongo;
use SoftDeletes,UseMongo,EncodeUTF8;
private const cast_utf8 = [
'subject',
'msg',
];
protected $dates = ['datetime','sent_at'];

View File

@ -30,4 +30,14 @@ trait UseMongo
{
$this->attributes['msg'] = utf8_encode($value);
}
public function getSubjectAttribute($value): string
{
return utf8_decode($value);
}
public function setSubjectAttribute($value): void
{
$this->attributes['subject'] = utf8_encode($value);
}
}

View File

@ -97,7 +97,7 @@
<div class="row pb-2">
<div class="col-8">
SUBJECT: <strong class="highlight">{{ $msg->subject }}</strong>
SUBJECT: <strong class="highlight">{!! \App\Classes\FTN\Message::tr($msg->subject) !!}</strong>
</div>
</div>