Skip to content

Instantly share code, notes, and snippets.

@Titoratus
Created April 21, 2019 17:51
Show Gist options
  • Select an option

  • Save Titoratus/b505a0e5fd330c1be61a4d2d61aa543b to your computer and use it in GitHub Desktop.

Select an option

Save Titoratus/b505a0e5fd330c1be61a4d2d61aa543b to your computer and use it in GitHub Desktop.

Revisions

  1. Titoratus created this gist Apr 21, 2019.
    7 changes: 7 additions & 0 deletions [OctoberCMS] Cross reference table
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    https://octobercms.com/docs/database/relations#many-to-many

    Таблица, которая нужна для связывания записей одной таблицы с записями другой называется сross reference table.
    Нужно получить значение из другой связанной таблицы? Прописываем для той модели, записи которой выводим:
    public $belongsToMany = [
    'phones' => ['estar\hotel\Models\Phone', 'table' => 'estar_hotel_users_phones']
    ];