belongsTo(Customer::class); } public function orders() { return $this->hasMany(Order::class); } public function scopeByCustomer($query, $id) { return $query->where('customer_id', $id); } public function scopeByDelivery($query) { return $query->byType(1); } public function scopeByInvoicing($query) { return $query->byType(2); } public function scopeByType($query, $id) { return $query->where('type', $id); } public function scopeDefault($query) { return $query->where('priority', 1); } }