我有以下架构
CREATE TABLE `attributes` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `records` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`event_school_id` bigint(20) unsigned NOT NULL,
`athlete_id` bigint(20) unsigned NOT NULL,
`year` int(10) unsigned NOT NULL,
`place` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `records_event_school_id_foreign` (`event_school_id`),
KEY `records_athlete_id_foreign` (`athlete_id`),
CONSTRAINT `records_athlete_id_foreign` FOREIGN KEY (`athlete_id`) REFERENCES `athletes` (`id`),
CONSTRAINT `records_event_school_id_foreign` FOREIGN KEY (`event_school_id`) REFERENCES `event_school` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
如何在 laravel 中正确设置模型?对于attribute_record 表,属性和记录之间的关系中存在一个值。我想知道是否需要attribute_record 表的模型。
慕姐8265434
萧十郎