В таблицу topic добавить строку event_id
В таблицу speaker добавить строку topic_id
В модель event
public function topic()
{
return $this->hasMany(Topic::class, 'event_id', 'event_id');
}
В модель topic
public function event(): BelongsTo
{
return $this->belongsTo(Event::class, 'event_id', 'event_id');
}
public function speaker()
{
return $this->hasMany(Speaker::class, 'topic_id', 'topic_id');
}
Speaker модель
public function topic(): BelongsTo
{
return $this->belongsTo(Topic::class, 'topic_id', 'topic_id');
}