43 lines
946 B
PHP
43 lines
946 B
PHP
<?php
|
|
|
|
namespace Convoy\Models;
|
|
|
|
use Convoy\Casts\NullableEncrypter;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Coterm extends Model
|
|
{
|
|
protected $guarded = [
|
|
'id',
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'token_id', 'token',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_tls_enabled' => 'boolean',
|
|
'coterm_token' => NullableEncrypter::class,
|
|
];
|
|
|
|
public static array $validationRules = [
|
|
'name' => 'required|string|max:191',
|
|
'is_tls_enabled' => 'required|boolean',
|
|
'fqdn' => 'required|string|max:191',
|
|
'port' => 'required|integer|min:1|max:65535',
|
|
'token_id' => 'required|string|max:191',
|
|
'token' => 'required|string|max:191',
|
|
];
|
|
|
|
public function nodes(): HasMany
|
|
{
|
|
return $this->hasMany(Node::class);
|
|
}
|
|
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'id';
|
|
}
|
|
}
|