43 lines
929 B
PHP
43 lines
929 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ServerUserBinding extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'server_resource_id',
|
|
'username',
|
|
'remote_exists',
|
|
'force_password_change',
|
|
'last_synced_at',
|
|
'metadata',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function server(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ServerResource::class, 'server_resource_id');
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'remote_exists' => 'boolean',
|
|
'force_password_change' => 'boolean',
|
|
'last_synced_at' => 'datetime',
|
|
'metadata' => 'array',
|
|
];
|
|
}
|
|
}
|