2020-04-04 06:40:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property int $id
|
2020-04-04 17:59:25 +00:00
|
|
|
* @property int $server_id
|
2020-04-04 06:40:20 +00:00
|
|
|
* @property int $uuid
|
|
|
|
* @property string $name
|
2020-04-04 19:26:39 +00:00
|
|
|
* @property string $ignored_files
|
2020-04-04 06:40:20 +00:00
|
|
|
* @property string $disk
|
|
|
|
* @property string|null $sha256_hash
|
|
|
|
* @property int $bytes
|
|
|
|
* @property \Carbon\CarbonImmutable|null $completed_at
|
|
|
|
* @property \Carbon\CarbonImmutable $created_at
|
|
|
|
* @property \Carbon\CarbonImmutable $updated_at
|
|
|
|
* @property \Carbon\CarbonImmutable|null $deleted_at
|
2020-04-04 17:59:25 +00:00
|
|
|
*
|
|
|
|
* @property \Pterodactyl\Models\Server $server
|
2020-04-04 06:40:20 +00:00
|
|
|
*/
|
|
|
|
class Backup extends Model
|
|
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
|
2020-04-04 17:59:25 +00:00
|
|
|
const RESOURCE_NAME = 'backup';
|
|
|
|
|
2020-04-04 06:40:20 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $table = 'backups';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $immutableDates = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'id' => 'int',
|
|
|
|
'bytes' => 'int',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dates = [
|
|
|
|
'completed_at',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
2020-04-04 19:26:39 +00:00
|
|
|
* @var array
|
2020-04-04 06:40:20 +00:00
|
|
|
*/
|
2020-04-04 19:26:39 +00:00
|
|
|
protected $attributes = [
|
|
|
|
'sha256_hash' => null,
|
|
|
|
'bytes' => 0,
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public static $validationRules = [
|
|
|
|
'server_id' => 'bail|required|numeric|exists:servers,id',
|
|
|
|
'uuid' => 'required|uuid',
|
2020-04-04 19:30:29 +00:00
|
|
|
'name' => 'required|string',
|
2020-04-04 19:26:39 +00:00
|
|
|
'ignored_files' => 'string',
|
|
|
|
'disk' => 'required|string',
|
|
|
|
'sha256_hash' => 'nullable|string',
|
|
|
|
'bytes' => 'numeric',
|
|
|
|
];
|
2020-04-04 17:59:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function server()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Server::class);
|
|
|
|
}
|
2020-04-04 06:40:20 +00:00
|
|
|
}
|