mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Add no_proxy and other proxy related settings Set user agent on all http client requests Unify http client usage * Style fixes * Remove useless use statements * Correct variable, good job phpstan * Add tests fix https_proxy bug add tcp:// to the config settings format * style and lint fixes * Remove guzzle from the direct dependencies * Use built in Laravel testing functionality * update baseline
33 lines
710 B
PHP
33 lines
710 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use LibreNMS\Alert\Transport;
|
|
use LibreNMS\Alert\Transport\Dummy;
|
|
|
|
class AlertTransport extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $primaryKey = 'transport_id';
|
|
public $timestamps = false;
|
|
protected $casts = [
|
|
'is_default' => 'boolean',
|
|
'transport_config' => 'array',
|
|
];
|
|
protected $fillable = ['transport_config'];
|
|
|
|
public function instance(): Transport
|
|
{
|
|
$class = Transport::getClass($this->transport_type);
|
|
|
|
if (class_exists($class)) {
|
|
return new $class($this);
|
|
}
|
|
|
|
return new Dummy;
|
|
}
|
|
}
|