series()->count() > 0) { return $this->series()->orderBy('id', 'desc')->first()->series; } return null; } /** * Get all of the series for the Branch */ public function series(): HasMany { return $this->hasMany(Series::class); } public function getIsClientVatableAttribute(): bool { return $this->client->vatable; } /** * Get the client that owns the Branch */ public function client(): BelongsTo { return $this->belongsTo(Client::class); } /** * Get all the sales for the Branch */ public function sales(): HasMany { return $this->hasMany(Sale::class); } /** * Get all the expenses for the Branch */ public function expenses(): HasMany { return $this->hasMany(Expense::class); } public function balances(): HasMany { return $this->hasMany(Balance::class); } public function accounts(): \Znck\Eloquent\Relations\BelongsToThrough { return $this->belongsToThrough(Account::class, Balance::class); } public function transactions(): HasMany { return $this->hasMany(Transaction::class); } }