diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index 857388b..2beb78a 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -16,7 +16,8 @@ class Echomail extends Model implements Packet protected $collection = FALSE; private const cast_utf8 = [ - 'msg' + 'subject', + 'msg', ]; protected $dates = ['datetime']; diff --git a/app/Models/Netmail.php b/app/Models/Netmail.php index b569f70..c67f379 100644 --- a/app/Models/Netmail.php +++ b/app/Models/Netmail.php @@ -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']; diff --git a/app/Traits/UseMongo.php b/app/Traits/UseMongo.php index 5b786c1..eb78739 100644 --- a/app/Traits/UseMongo.php +++ b/app/Traits/UseMongo.php @@ -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); + } } \ No newline at end of file diff --git a/resources/views/pkt.blade.php b/resources/views/pkt.blade.php index e7cf785..65986ee 100644 --- a/resources/views/pkt.blade.php +++ b/resources/views/pkt.blade.php @@ -97,7 +97,7 @@