Initial integration with Quickbooks

This commit is contained in:
Deon George
2019-06-12 16:25:15 +10:00
parent eb254def7a
commit 9fa773d283
12 changed files with 658 additions and 2 deletions

View File

@@ -36,6 +36,11 @@ class Account extends Model
return $this->belongsTo(Country::class);
}
public function external()
{
return $this->belongsToMany(External\Integrations::class,'external_account',NULL,'external_integration_id');
}
public function invoices()
{
return $this->hasMany(Invoice::class);
@@ -91,6 +96,11 @@ class Account extends Model
return sprintf('<a href="/r/switch/start/%s"><i class="fa fa-external-link"></i></a>',$this->user_id);
}
public function getTypeAttribute()
{
return $this->company ? 'Business' : 'Private';
}
private function _address()
{
$return = [];
@@ -131,4 +141,19 @@ class Account extends Model
return $item->active AND $item->due > 0;
});
}
/**
* Get the external account ID for a specific integration
*
* @param External\Integrations $o
* @return mixed
*/
public function ExternalAccounting(External\Integrations $o)
{
return $this
->external()
->where('id','=',$o->id)
->where('site_id','=',$this->site_id)
->first();
}
}