hasMany(Customer::class); } public function SaleChannel() { return $this->belongsTo(SaleChannel::class); } public function scopeActive() { return $this->byActive(1); } public function scopeByActive($query, $active) { return $query->where($this->table . '.active', $active); } public function scopeByPublic($query, $is_public) { return $query->where($this->table . '.is_public', $is_public); } public function scopeAtHouse($query) { return $query->where($this->table . '.at_house', 1); } public function scopeInactive() { return $this->byActive(0); } public function scopeManaged() { return $this->byPublic(0); } public function scopePublic() { return $this->byPublic(1); } }