Initial integration with Quickbooks
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user