Work on products, first completed broadband

This commit is contained in:
Deon George
2021-12-24 12:14:01 +11:00
parent 8f5293662e
commit 1e9f15b40f
62 changed files with 2139 additions and 894 deletions

View File

@@ -7,25 +7,22 @@ use Illuminate\Database\Eloquent\Model;
use Leenooks\Traits\ScopeActive;
use App\Interfaces\IDs;
use App\Traits\NextKey;
/**
* Class Account
* Service Accounts
*
* Attributes for accounts:
* + lid: : Local ID for account
* + sid: : System ID for account
* + name: : Account Name
* + lid : Local ID for account
* + sid : System ID for account
* + name : Account Name
* + taxes : Taxes Applicable to this account
*
* @package App\Models
*/
class Account extends Model implements IDs
{
use HasFactory,NextKey,ScopeActive;
const RECORD_ID = 'account';
public $incrementing = FALSE;
use HasFactory,ScopeActive;
const CREATED_AT = 'date_orig';
const UPDATED_AT = 'date_last';
@@ -67,6 +64,11 @@ class Account extends Model implements IDs
return $this->belongsToMany(External\Integrations::class,'external_account',NULL,'external_integration_id');
}
public function group()
{
return $this->hasOneThrough(Group::class,AccountGroup::class,'account_id','id','id','group_id');
}
public function invoices()
{
return $this->hasMany(Invoice::class);
@@ -89,6 +91,11 @@ class Account extends Model implements IDs
return $active ? $query->active() : $query;
}
public function taxes()
{
return $this->hasMany(Tax::class,'country_id','country_id');
}
public function user()
{
return $this->belongsTo(User::class);