Create model and migration for prelim definitions
This commit is contained in:
parent
1953eedb0b
commit
a7d1776c44
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class prelim_definition extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'audition_id',
|
||||||
|
'room_id',
|
||||||
|
'order_in_room',
|
||||||
|
'scoring_guide_id',
|
||||||
|
'passing_score',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function audition(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Audition::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function room(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Room::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scoringGuide(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ScoringGuide::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Audition;
|
||||||
|
use App\Models\Room;
|
||||||
|
use App\Models\ScoringGuide;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('prelim_definitions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignIdFor(Audition::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||||
|
$table->foreignIdFor(Room::class)->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
|
||||||
|
$table->integer('order_in_room')->nullable();
|
||||||
|
$table->foreignIdFor(ScoringGuide::class)->nullable()->constrained()->nullOnDelete()->cascadeOnUpdate();
|
||||||
|
$table->float('passing_score');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('prelim_definitions');
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue