Initial commit
This commit is contained in:
26
app/Models/Question.php
Normal file
26
app/Models/Question.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
#[Fillable(['quiz_id', 'title', 'context', 'label', 'points', 'type'])]
|
||||
class Question extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function quiz(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Quiz::class);
|
||||
}
|
||||
|
||||
public function options(): HasMany
|
||||
{
|
||||
return $this->hasMany(Option::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user