PHP Laravel 5.5 belongsToMany multi-table query table duplicate problem

the name of the operator (that is, the name of the recorder) when the employee under the department is added through the department multi-table.

existing

one 
    one_id
    tow_idID
tow
    tow_idID
    name  
    tows_id(IDID)

SQL

select c.name from one as a join tow as b join tow as c where a.one_id = 1 a.tow_id = b.tow_id and b.tows.id = c.tow_id;

Please give me some advice on how to write laravel belongsToMany. Thank you!

Mar.28,2021

there is something wrong with the construction of your table. Which employee's id is recorded in the id, of the subtable in the main table? it should be the field of department id added to the employee table. Then the department can belongsToMany employees.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c23c16-3368a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c23c16-3368a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?