belongsTo(SaleChannel::class); } public function tariff_unity() { return $this->belongsTo(TariffUnity::class); } public function price_lists() { return $this->hasMany(PriceList::class); } public function scopeByAutocomplete($query, $str) { return $query->where($this->table . '.name', 'LIKE', "%${str}%") ->orWhere($this->table . '.ref', 'LIKE', "${str}%") ->orWhere($this->table . '.code', 'LIKE', "${str}%"); } public function scopeBySaleChanel($query, $id) { return $query->where($this->table . '.sale_channel_id', $id); } public function scopeByStatus($query, $id) { return $query->where($this->table . '.status_id', $id); } }