Compare commits
2 Commits
aa073a5029
...
77799b26cc
| Author | SHA1 | Date | |
|---|---|---|---|
| 77799b26cc | |||
| 837d86ae21 |
10
README.md
10
README.md
@ -13,28 +13,34 @@
|
||||
|
||||
- BelongsTo MemberRank
|
||||
- HasMany ExamMemberRankAnswer
|
||||
- BelongsToMany ExamMemberRank
|
||||
|
||||
## ExamTyperatingQuestion
|
||||
|
||||
- BelongsTo Typerating
|
||||
- HasMany ExamTyperatingAnswer
|
||||
- BelongsToMany ExamTyperating
|
||||
|
||||
## ExamMemberRankAnswer
|
||||
|
||||
- BelongsTo ExamMemberRankQuestion
|
||||
- BelongsToMany ExamMemberRank
|
||||
|
||||
## ExamTyperatingAnswer
|
||||
|
||||
- BelongsTo ExamTyperatingQuestion
|
||||
- BelongsToMany ExamTyperating
|
||||
|
||||
## ExamMemberRank
|
||||
|
||||
- BelongsTo MemberRank
|
||||
- **TODO** BelongsTo Member (External DB)
|
||||
- **TODO** HasMany ExamMemberRankQuestion
|
||||
- BelongsToMany ExamMemberRankQuestion
|
||||
- BelongsToMany ExamMemberRankAnswers
|
||||
|
||||
## ExamTyperating
|
||||
|
||||
- BelongsTo Typerating
|
||||
- **TODO** BelongsTo Member (External DB)
|
||||
- **TODO** HasMany ExamTyperatingQuestion
|
||||
- BelongsToMany ExamTyperatingQuestion
|
||||
- BelongsToMany ExamTyperatingAnswers
|
||||
|
||||
@ -12,9 +12,4 @@ class ExamMemberRank extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->where('member_rank_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,4 @@ class ExamMemberRankAnswer extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->leftJoin('exam_questions', 'exam_questions.id', 'exam_answers.exam_question_id');
|
||||
$query->where('exam_questions.member_rank_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,9 +13,4 @@ class ExamMemberRankQuestion extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->where('member_rank_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,4 @@ class ExamTyperating extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->where('typerating_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,4 @@ class ExamTyperatingAnswer extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->leftJoin('exam_questions', 'exam_questions.id', 'exam_answers.exam_question_id');
|
||||
$query->where('exam_questions.typerating_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,9 +13,4 @@ class ExamTyperatingQuestion extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function listExtendQuery($query)
|
||||
{
|
||||
$query->where('typerating_id', '<>', null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
name: Exam Typerating Answer
|
||||
form: $/germanairlinesva/schooling/models/examtyperatinganswer/fields.yaml
|
||||
modelClass: GermanAirlinesVa\Schooling\Models\ExamMemberRankAnswer
|
||||
modelClass: GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer
|
||||
defaultRedirect: germanairlinesva/schooling/examtyperatinganswer
|
||||
create:
|
||||
redirect: 'germanairlinesva/schooling/examtyperatinganswer/update/:id'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
list: $/germanairlinesva/schooling/models/examtyperatinganswer/columns.yaml
|
||||
modelClass: GermanAirlinesVa\Schooling\Models\ExamMemberRankAnswer
|
||||
modelClass: GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer
|
||||
title: Exam Typerating Answers
|
||||
noRecordsMessage: 'backend::lang.list.no_records'
|
||||
showSetup: true
|
||||
|
||||
@ -34,4 +34,33 @@ class ExamMemberRank extends Model
|
||||
public $belongsTo = [
|
||||
'member_rank' => 'GermanAirlinesVa\Schooling\Models\MemberRank',
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_questions' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamMemberRankQuestion',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_id',
|
||||
'otherKey' => 'exam_question_id',
|
||||
],
|
||||
'exam_answers' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamMemberRankAnswer',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_id',
|
||||
'otherKey' => 'exam_answer_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_member_rank_member_rank_id', function ($builder) {
|
||||
$builder->where('member_rank_id', '<>', null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,4 +33,29 @@ class ExamMemberRankAnswer extends Model
|
||||
public $belongsTo = [
|
||||
'exam_question' => ['GermanAirlinesVa\Schooling\Models\ExamMemberRankQuestion', 'key' => 'exam_question_id'],
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_member_ranks' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamMemberRank',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_answer_id',
|
||||
'otherKey' => 'exam_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_member_rank_answer_member_rank_id', function ($builder) {
|
||||
$builder->whereHas('exam_question', function ($query) {
|
||||
$query->where('member_rank_id', '<>', null);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,33 @@ class ExamMemberRankQuestion extends Model
|
||||
];
|
||||
|
||||
public $hasMany = [
|
||||
'exam_answers' => 'GermanAirlinesVa\Schooling\Models\ExamMemberRankAnswer',
|
||||
'exam_answers' => ['GermanAirlinesVa\Schooling\Models\ExamMemberRankAnswer', 'key' => 'exam_question_id'],
|
||||
];
|
||||
|
||||
public $belongsTo = [
|
||||
'member_rank' => 'GermanAirlinesVa\Schooling\Models\MemberRank',
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_member_ranks' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamMemberRank',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_question_id',
|
||||
'otherKey' => 'exam_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_member_rank_question_member_rank_id', function ($builder) {
|
||||
$builder->where('member_rank_id', '<>', null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,4 +34,33 @@ class ExamTyperating extends Model
|
||||
public $belongsTo = [
|
||||
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_questions' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamTyperatingQuestion',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_id',
|
||||
'otherKey' => 'exam_question_id',
|
||||
],
|
||||
'exam_answers' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_id',
|
||||
'otherKey' => 'exam_answer_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_typerating_typerating_id', function ($builder) {
|
||||
$builder->where('typerating_id', '<>', null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php namespace GermanAirlinesVa\Schooling\Models;
|
||||
|
||||
use Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* Model
|
||||
@ -33,4 +34,29 @@ class ExamTyperatingAnswer extends Model
|
||||
public $belongsTo = [
|
||||
'exam_question' => ['GermanAirlinesVa\Schooling\Models\ExamTyperatingQuestion', 'key' => 'exam_question_id'],
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_typeratings' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamTyperating',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_answer_id',
|
||||
'otherKey' => 'exam_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_typerating_answer_typerating_id', function (Builder $builder) {
|
||||
$builder->whereHas('exam_question', function ($query) {
|
||||
$query->where('typerating_id', '<>', null);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,33 @@ class ExamTyperatingQuestion extends Model
|
||||
];
|
||||
|
||||
public $hasMany = [
|
||||
'exam_answers' => 'GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer',
|
||||
'exam_answers' => ['GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer', 'key' => 'exam_question_id'],
|
||||
];
|
||||
|
||||
public $belongsTo = [
|
||||
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
|
||||
];
|
||||
|
||||
public $belongsToMany = [
|
||||
'exam_typeratings' => [
|
||||
'GermanAirlinesVa\Schooling\Models\ExamTyperating',
|
||||
'table' => 'exam_exam_answer_exam_question',
|
||||
'key' => 'exam_question_id',
|
||||
'otherKey' => 'exam_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booting" method of the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::addGlobalScope('exam_typerating_question_typerating_id', function ($builder) {
|
||||
$builder->where('typerating_id', '<>', null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
<?php namespace GermanAirlinesVa\Schooling\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateExamExamAnswerExamQuestion extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection('germanairlinesva_schooling')->create('exam_exam_answer_exam_question', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->bigIncrements('id')->unsigned();
|
||||
$table->bigInteger('exam_id')->unsigned();
|
||||
$table
|
||||
->foreign('exam_id')
|
||||
->references('id')
|
||||
->on('exams');
|
||||
$table->bigInteger('exam_answer_id')->unsigned();
|
||||
$table
|
||||
->foreign('exam_answer_id')
|
||||
->references('id')
|
||||
->on('exam_answers');
|
||||
$table->bigInteger('exam_question_id')->unsigned();
|
||||
$table
|
||||
->foreign('exam_question_id')
|
||||
->references('id')
|
||||
->on('exam_questions');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection('germanairlinesva_schooling')->disableForeignKeyConstraints();
|
||||
Schema::dropIfExists('germanairlinesva_schooling_exam_exam_answer_exam_question');
|
||||
Schema::connection('germanairlinesva_schooling')->disableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
@ -13,3 +13,5 @@
|
||||
- builder_table_create_exam_answers.php
|
||||
- 'Created table exams'
|
||||
- builder_table_create_exams.php
|
||||
- 'Created table exam_exam_answer_exam_question'
|
||||
- builder_table_create_exam_exam_answer_exam_question.php
|
||||
|
||||
@ -41,9 +41,9 @@ p-defer@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c"
|
||||
integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=
|
||||
|
||||
"php-parser@git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1":
|
||||
"php-parser@https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1":
|
||||
version "3.0.2"
|
||||
resolved "git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||
resolved "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||
|
||||
prettier@^2.3.2:
|
||||
version "2.3.2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user