<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Crypt;

class NexmoSettings extends Model
{
	
	use SoftDeletes;
	
	protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
	
	public function company()
	{
		return $this->belongsTo('App\Company');
	}
	
	public function setVirtualNumberAttribute($virtual_number)
	{
		$this->attributes['virtual_number'] = Crypt::encryptString($virtual_number);
	}
	
	public function getVirtualNumberAttribute()
	{
		return Crypt::decryptString($this->attributes['virtual_number']);
	}
	
	public function setApiKeyAttribute($api_key)
	{
		$this->attributes['api_key'] = Crypt::encryptString($api_key);
	}
	
	public function getApiKeyAttribute()
	{
		return Crypt::decryptString($this->attributes['api_key']);
	}
	
	public function setApiSecretAttribute($api_secret)
	{
		$this->attributes['api_secret'] = Crypt::encryptString($api_secret);
	}
	
	public function getApiSecretAttribute()
	{
		return Crypt::decryptString($this->attributes['api_secret']);
	}
	
}
