this is my code:
$customer = CustomerRepository::getInstance()->read($id)->first();
$contacts = $customer->getContacts();
$data = $contacts->where('firstname', '=', 'test' )
->orWhere('lastname', '=', 'test2')
->orderBy('lastname', 'asc'])->paginate(15);
...
public function getContacts()
{
return $this->morphToMany(Contact::class, 'contactable');
}
I only want the contacts from the customer which has the certain firstname or lastname , why i get every contact from the Database table?
UPDATE:
So i found out, if i delete the orWhere
clauses it works, but with the orWhere
i get every contact. But how can i do it with the orWhere Clause?