For example, table A has x_id, y_id, and table B also has x_id, y_id. The two fields in table A are 1 to multiple B tables.
select XXX from A left join B on A.x_id = B.x_id and A.y_id = B.y_id
There are belongsTo and belongsToMany in laravel. Finding relevant documents may not be able to meet my needs. The key is that there is an And relationship here.
Redesign the database table structure. Add an auto-incrementing primary key to table A. The x_id and y_id in table A are jointly unique, UNIQUE KEY A_x_id_y_id_UNIQUE (x_id, y_id). Then joining is easy.