、私はボクシングの結果のウェブサイトを作成しています、私は結果過去のボクサーを取得しようとしていますが、関係に苦しんでいます...例えばLaravel関係
、ボクサーは、多くのイベントを持つことができます(戦い)、1つの結果(勝利、引き分け、敗北)と1人の対戦相手を持つ。私は相手の情報と、ボクサーの結果のすべてを表示する
をしようとしています、私はボクサーのテーブルを持っている構造(必要に応じて関係IDを追加することができます)
Schema::create('events', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->date('date');
$table->string('location');
$table->timestamps();
$table->softDeletes();
});
とイベントがあり
Schema::create('boxers', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('status');
$table->string('division');
$table->string('stance');
$table->date('dob');
$table->integer('height');
$table->string('nationality');
$table->string('residence');
$table->string('birthplace');
$table->timestamps();
$table->softDeletes();
});
と私が取得するために追加して変更する必要がありますどのような結果
Schema::create('results', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->integer('event_id');
$table->string('result');
$table->timestamps();
$table->softDeletes();
});
関係が正しく働くか?