Test that a deleted backup makes an audit log entry
This commit is contained in:
parent
d33522c857
commit
d3e3b1db38
4 changed files with 83 additions and 2 deletions
|
@ -69,6 +69,7 @@ class AuditLog extends Model
|
|||
* @var string[]
|
||||
*/
|
||||
protected $casts = [
|
||||
'is_system' => 'bool',
|
||||
'device' => 'array',
|
||||
'metadata' => 'array',
|
||||
];
|
||||
|
|
|
@ -21,6 +21,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
* @property \Carbon\CarbonImmutable|null $deleted_at
|
||||
* @property \Pterodactyl\Models\Server $server
|
||||
* @property \Pterodactyl\Models\AuditLog[] $audits
|
||||
*/
|
||||
class Backup extends Model
|
||||
{
|
||||
|
@ -98,4 +99,14 @@ class Backup extends Model
|
|||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function audits()
|
||||
{
|
||||
return $this->hasMany(AuditLog::class, 'metadata->backup_uuid', 'uuid')
|
||||
->where('action', 'LIKE', 'server:backup.%');
|
||||
// ->where('metadata->backup_uuid', $this->uuid);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue