I have 3 tables of funcionário
, apontamentos
and horastrabalhadas
.
My relationship is hasmany
1 employee has multiple apontamentos
.
When I show the result with a dd()
, the employee data comes twice and the horastrabalhadas
is blank. It has to invert from hasMany
to belongTo
to see if my logic was wrong but came the same thing.
notes
CREATE TABLE IF NOT EXISTS Notes (id int (10) unsigned NOT NULL AUTO_INCREMENT, varchar pointing (255) COLLATE utf8_unicode_ci NOT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL, PRIMARY KEY (id)) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 4;
teamwork
CREATE TABLE IF NOT TECHNICAL EXISTS (id int (10) unsigned NOT NULL AUTO_INCREMENT, matricula int (10) unsigned NOT NULL, name varchar (150) COLLATE utf8_unicode_ci NOT NULL, position varchar (150) COLLATE utf8_unicode_ci DEFAULT NULL, loadhoraria int (10) unsigned NOT NULL, name team varchar (150) COLLATE utf8_unicode_ci DEFAULT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL, PRIMARY KEY (id)) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 3;
hhs
CREATE TABLE IF NOT EXISTS hhs (id int (10) unsigned NOT NULL AUTO_INCREMENT, idequipe int (10) unsigned NOT NULL, idaption int (10) unsigned NOT NULL, datename datetime NOT NULL, timeaptionrequest time NOT NULL, timeappointmentinthe time NOT NULL, numeroos int (11) NOT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL, PRIMARY KEY (id), KEY hhs_idequipe_foreign (idequipe), KEY hhs_idapontamento_foreign (idapontamento)) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci
Has anything like this ever happened to anyone?