Skip to content

Instantly share code, notes, and snippets.

@Titoratus
Created April 21, 2019 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Titoratus/b505a0e5fd330c1be61a4d2d61aa543b to your computer and use it in GitHub Desktop.
Save Titoratus/b505a0e5fd330c1be61a4d2d61aa543b to your computer and use it in GitHub Desktop.
[OctoberCMS] Cross reference table
https://octobercms.com/docs/database/relations#many-to-many
Таблица, которая нужна для связывания записей одной таблицы с записями другой называется сross reference table.
Нужно получить значение из другой связанной таблицы? Прописываем для той модели, записи которой выводим:
public $belongsToMany = [
'phones' => ['estar\hotel\Models\Phone', 'table' => 'estar_hotel_users_phones']
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment