fix: server saving
This commit is contained in:
@@ -17,10 +17,14 @@ class Server extends BaseModel
|
|||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::saving(function ($server) {
|
static::saving(function ($server) {
|
||||||
$server->forceFill([
|
$payload = [];
|
||||||
'ip' => Str::of($server->ip)->trim(),
|
if ($server->user) {
|
||||||
'user' => Str::of($server->user)->trim(),
|
$payload['user'] = Str::of($server->user)->trim();
|
||||||
]);
|
}
|
||||||
|
if ($server->ip) {
|
||||||
|
$payload['ip'] = Str::of($server->ip)->trim();
|
||||||
|
}
|
||||||
|
$server->forceFill($payload);
|
||||||
});
|
});
|
||||||
|
|
||||||
static::created(function ($server) {
|
static::created(function ($server) {
|
||||||
|
Reference in New Issue
Block a user