for example I have 3 tables and that tables has a relation,
Table A
- id
- name
Table B
- id
- tableId_A
- tableId_C
Table C
- id
- name
i'm using table C but i want to search items by request name that have the same name as in table A using query eloquent and this is the query, i'm using a laravel
$this->model->query()
->withWhereHas('tableB', function($query) use ($names) {
$query->tableB->where('name', 'LIKE', "%{$names}%");})
how to fix it using eloquent where has used 3 tables relation?