mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
bug - Component "error" length issue (#15918)
* truncate component error in F5 LTM code * sanity check in COmponent * style * mutators * mutators moved * moving * Mutators OK, removing check from F5 * style * fix LibreNMS/Component.php * remove protected and see if it fixes issues * nullable * nullable * nullable
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
@@ -53,6 +54,27 @@ class Component extends DeviceRelatedModel
|
||||
$this->attributes['ignore'] = (int) $ignore;
|
||||
}
|
||||
|
||||
public function error(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (?string $value) => is_null($value) ? null : substr($value, 0, 255),
|
||||
);
|
||||
}
|
||||
|
||||
public function label(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (?string $value) => is_null($value) ? null : substr($value, 0, 255),
|
||||
);
|
||||
}
|
||||
|
||||
public function type(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (?string $value) => is_null($value) ? null : substr($value, 0, 50),
|
||||
);
|
||||
}
|
||||
|
||||
// ---- Define Relationships ----
|
||||
|
||||
public function logs(): HasMany
|
||||
|
Reference in New Issue
Block a user