. * * @link https://www.librenms.org * * @copyright 2018 Tony Murray * @author Tony Murray */ namespace App\Models; use Illuminate\Database\Eloquent\SoftDeletes; use LibreNMS\Util\StringHelpers; class Application extends DeviceRelatedModel { use SoftDeletes; public $timestamps = false; protected $primaryKey = 'app_id'; protected $fillable = ['device_id', 'app_type', 'app_instance', 'app_status', 'app_state', 'data', 'deleted_at', 'discovered']; protected $casts = [ 'data' => 'array', ]; // ---- Helper Functions ---- public function displayName() { return StringHelpers::niceCase($this->app_type); } public function getShowNameAttribute() { return $this->displayName(); } // ---- Define Relationships ---- public function metrics() { return $this->hasMany(ApplicationMetric::class, 'app_id', 'app_id'); } }