0
0

More than 3 years have passed since last update.

belongsToManyの引数

Last updated at Posted at 2020-08-13

用途

多対多の関係を持たせるためのメソッド

引数に何を入れるか

usersとrolesが多対多の関係を持っている
Userのモデルに記載するbelongsToManyの書き方

belongsToMany('User側の外部キーがあるテーブルがあるクラス名',
'User側の外部キーがあるテーブル名',
'リレーションを定義しているモデル(User)の外部キー名',
'結合するモデルの外部キー名')
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0