Change our $casts array to a casts() function for our updated laravel, fix incoming TICs to not export to our system
This commit is contained in:
parent
e2cd09ac98
commit
8edc45fbd5
@ -9,10 +9,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\{Message,Packet};
|
||||
use App\Classes\FTN\Packet;
|
||||
use App\Exceptions\InvalidFTNException;
|
||||
use App\Traits\{QueryCacheableConfig,ScopeActive};
|
||||
|
||||
|
@ -6,7 +6,10 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class AddressEchoarea extends Pivot
|
||||
{
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'subscribed' => 'datetime:Y-m-d H:i',
|
||||
];
|
||||
}
|
||||
}
|
@ -28,9 +28,12 @@ class Domain extends Model
|
||||
private const CACHE_TIME = 3600;
|
||||
private const STATS_MONTHS = 6;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'homepage' => CompressedStringOrNull::class,
|
||||
];
|
||||
}
|
||||
|
||||
/* SCOPES */
|
||||
|
||||
|
@ -11,12 +11,15 @@ class Dynamic extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'arguments' => CollectionOrNull::class,
|
||||
'next_at' => 'datetime:Y-m-d H:i:s',
|
||||
'start_date' => 'datetime:Y-m-d',
|
||||
'start_time' => 'datetime:H:i:s',
|
||||
];
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
|
@ -45,10 +45,13 @@ class Echoarea extends Model
|
||||
|
||||
private const CACHE_TIME = 3600;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'first_message' => 'datetime:Y-m-d H:i:s',
|
||||
'last_message' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
|
@ -34,7 +34,9 @@ final class Echomail extends Model implements Packet
|
||||
// When generating a packet for this echomail, the packet recipient is our tftn
|
||||
public Address $tftn;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'to' => UTF8StringOrNull::class,
|
||||
'from' => UTF8StringOrNull::class,
|
||||
'subject' => UTF8StringOrNull::class,
|
||||
@ -45,6 +47,7 @@ final class Echomail extends Model implements Packet
|
||||
'rogue_seenby' => CollectionOrNull::class,
|
||||
'rogue_path' => CollectionOrNull::class, // @deprecated?
|
||||
];
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
@ -258,7 +261,7 @@ final class Echomail extends Model implements Packet
|
||||
$exportto = $model
|
||||
->echoarea
|
||||
->addresses
|
||||
->filter(function($item) use ($model) { return $model->echoarea->can_read($item->security); })
|
||||
->filter(fn($item)=>$model->echoarea->can_read($item->security))
|
||||
->pluck('id')
|
||||
->diff(our_address($model->fftn->zone->domain,FALSE)->pluck('id'))
|
||||
->diff($seenby);
|
||||
|
@ -25,7 +25,9 @@ class File extends Model
|
||||
public Collection $set_seenby;
|
||||
public string $src_file = '';
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'kludges' => CollectionOrNull::class,
|
||||
'datetime' => 'datetime:Y-m-d H:i:s',
|
||||
'desc' => CompressedStringOrNull::class,
|
||||
@ -34,6 +36,7 @@ class File extends Model
|
||||
'rogue_path' => CollectionOrNull::class,
|
||||
'size' => 'int',
|
||||
];
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
@ -146,18 +149,21 @@ class File extends Model
|
||||
$rogue->push($sb);
|
||||
}
|
||||
|
||||
if (count($rogue)) {
|
||||
$model->rogue_seenby = $rogue;
|
||||
$model->save();
|
||||
}
|
||||
|
||||
$model->seenby()->sync($seenby);
|
||||
$model->save();
|
||||
|
||||
// See if we need to export this file.
|
||||
if ($model->filearea->sec_read) {
|
||||
$exportto = $model
|
||||
->filearea
|
||||
->addresses
|
||||
->filter(function($item) use ($model) { return $model->filearea->can_read($item->security); })
|
||||
->filter(fn($item)=>$model->filearea->can_read($item->security))
|
||||
->pluck('id')
|
||||
->diff(our_address($model->fftn->zone->domain,FALSE)->pluck('id'))
|
||||
->diff($seenby);
|
||||
|
||||
if ($exportto->count()) {
|
||||
|
@ -11,10 +11,13 @@ class Filearea extends Model
|
||||
{
|
||||
use SoftDeletes,ScopeActive,AreaSecurity;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'first_file' => 'datetime:Y-m-d H:i:s',
|
||||
'last_file' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
@ -9,14 +9,17 @@ class Job extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'payload' => 'array',
|
||||
'reserved_at' => 'datetime',
|
||||
'available_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
public function __construct(array $attributes=[])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->table = Config::get('queue.connections.' . (Config::get('queue.default', 'database')) . '.table', 'jobs');
|
||||
|
@ -34,7 +34,9 @@ final class Netmail extends Model implements Packet
|
||||
'Via' => 'set_path',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'to' => UTF8StringOrNull::class,
|
||||
'from' => UTF8StringOrNull::class,
|
||||
'subject' => UTF8StringOrNull::class,
|
||||
@ -44,6 +46,7 @@ final class Netmail extends Model implements Packet
|
||||
'msg_src' => CompressedStringOrNull::class,
|
||||
'sent_at' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
|
@ -9,9 +9,12 @@ class Nodelist extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'date' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
}
|
||||
|
||||
protected $fillable = ['date','domain_id'];
|
||||
|
||||
|
@ -12,9 +12,12 @@ class Origin extends Model
|
||||
|
||||
public const UPDATED_AT = NULL;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'value' => UTF8StringOrNull::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function complete(Address $o): string
|
||||
{
|
||||
|
@ -6,7 +6,10 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class ViaPivot extends Pivot
|
||||
{
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'datetime' => 'datetime',
|
||||
];
|
||||
}
|
||||
}
|
@ -35,10 +35,13 @@ class Setup extends Model
|
||||
public const MAX_BATCH_FILES = 5;
|
||||
public const MAX_MSGS_PKT = 50;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'options' => 'array',
|
||||
'servers' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
|
@ -17,9 +17,12 @@ class System extends Model
|
||||
|
||||
public const default = 'Discovered System';
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'last_session' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
}
|
||||
|
||||
/* STATIC */
|
||||
|
||||
|
@ -12,9 +12,12 @@ class Tagline extends Model
|
||||
|
||||
public const UPDATED_AT = NULL;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'value' => UTF8StringOrNull::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function complete(): string
|
||||
{
|
||||
|
@ -12,9 +12,12 @@ class Tearline extends Model
|
||||
|
||||
public const UPDATED_AT = NULL;
|
||||
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'value' => UTF8StringOrNull::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function complete(): string
|
||||
{
|
||||
|
@ -53,13 +53,16 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
* @return array
|
||||
*/
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'last_on' => 'datetime:Y-m-d H:i:s',
|
||||
'passkey' => 'json',
|
||||
];
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user