Skip to content

Commit 0de536f

Browse files
committed
KnowledgeEquityResponse Model and Migration
Bug: T419209
1 parent a89378e commit 0de536f

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

app/KnowledgeEquityResponse.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
9+
class KnowledgeEquityResponse extends Model
10+
{
11+
use HasFactory;
12+
13+
protected $fillable = [
14+
'selectedOption',
15+
'freeTextResponse',
16+
];
17+
18+
public function wiki(): BelongsTo {
19+
return $this->belongsTo(Wiki::class);
20+
}
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('knowledge_equity_responses', function (Blueprint $table) {
15+
$table->id();
16+
$table->timestamps();
17+
$table->unsignedInteger('wiki_id');
18+
$table->foreign('wiki_id')->references('id')->on('wikis');
19+
$table->enum('selectedOption', ['yes', 'no', 'unsure', 'unsaid']);
20+
$table->string('freeTextResponse')->nullable();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('knowledge_equity_responses');
30+
}
31+
};

0 commit comments

Comments
 (0)