belongsTo(Client::class); } /** * Get all of the series for the Branch * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function series(): HasMany { return $this->hasMany(Series::class); } public function getCurrentSeriesAttribute() { if ($this->series()->count() > 0) { return $this->series()->orderBy('id', 'desc')->first()->series; } return null; } /** * Get all of the sales for the Branch * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function sales(): HasMany { return $this->hasMany(Sale::class); } /** * Get all of the expenses for the Branch * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function expenses(): HasMany { return $this->hasMany(Expense::class); } }