Cast empty Collections to null, Cast strings to zstd compressed strings, add msg_src to echomails processed, fix duplicate seenbys

This commit is contained in:
Deon George
2022-10-30 23:42:30 +11:00
parent 31db017a0d
commit da85e85774
5 changed files with 100 additions and 43 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use App\Casts\CompressedString;
use App\Traits\{QueryCacheableConfig,ScopeActive};
class Domain extends Model
@@ -17,6 +18,10 @@ class Domain extends Model
private const CACHE_TIME = 3600;
private const STATS_MONTHS = 6;
protected $casts = [
'homepage' => CompressedString::class,
];
/* SCOPES */
/**
@@ -49,12 +54,7 @@ class Domain extends Model
public function getHomePageAttribute(string $value): string
{
//0xFD2FB528
return $value ? zstd_uncompress(base64_decode($value)) : 'No available information at the moment.';
}
public function setHomePageAttribute(string $value): void
{
$this->attributes['homepage'] = base64_encode(zstd_compress($value,9));
return $this->castAttribute('homepage',$value) ?: 'No available information at the moment.';
}
/* METHODS */