Files

37 lines
744 B
PHP
Raw Permalink Normal View History

2018-08-11 23:37:45 +02:00
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use LibreNMS\Interfaces\SnmptrapHandler;
2018-08-14 01:56:16 -05:00
use LibreNMS\Snmptrap\Handlers\Fallback;
2018-08-11 23:37:45 +02:00
class SnmptrapProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind(SnmptrapHandler::class, function ($app, $oid) {
if ($handler = config('snmptraps.trap_handlers.' . reset($oid))) {
return $app->make($handler);
}
return $app->make(Fallback::class);
});
}
}