belongsTo(Customer::class); } public function delivery() { return $this->belongsTo(Delivery::class); } public function scopeByCustomer($query, $customer_id) { return $query->where($this->table . '.customer_id', $customer_id); } public function scopeByDelivery($query, $customer_id) { return $query->where($this->table . '.delivery_id', $customer_id); } }