<?php

namespace App;

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

class QuickbooksSettings extends Model
{

	use SoftDeletes;
	
	protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
	
	public function company()
	{
		return $this->belongsTo('App\Company');
	}
	
	public function setAccessTokenAttribute($access_token)
	{
		$this->attributes['access_token'] = Crypt::encryptString($access_token);
	}
	
	public function getAccessTokenAttribute()
	{
		return Crypt::decryptString($this->attributes['access_token']);
	}
	
	public function setRefreshTokenAttribute($refresh_token)
	{
		$this->attributes['refresh_token'] = Crypt::encryptString($refresh_token);
	}
	
	public function getRefreshTokenAttribute()
	{
		return Crypt::decryptString($this->attributes['refresh_token']);
	}
	
	public function setRealmIdAttribute($realm_id)
	{
		$this->attributes['realm_id'] = Crypt::encryptString($realm_id);
	}
	
	public function getRealmIdAttribute()
	{
		return Crypt::decryptString($this->attributes['realm_id']);
	}

}
