58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
final class Screening extends Model
|
|
{
|
|
/**
|
|
* Fillable attributes for mass assignment.
|
|
*/
|
|
protected $fillable = [
|
|
'user_id',
|
|
'score',
|
|
'passed',
|
|
];
|
|
|
|
/**
|
|
* Cast attributes to specific types.
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'user_id' => 'integer',
|
|
'score' => 'integer',
|
|
'passed' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the user that owns this screening.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get all answers for this screening.
|
|
*/
|
|
public function answers(): HasMany
|
|
{
|
|
return $this->hasMany(ScreeningAnswer::class);
|
|
}
|
|
|
|
/**
|
|
* Get all sessions that reference this screening.
|
|
*/
|
|
public function sessions(): HasMany
|
|
{
|
|
return $this->hasMany(Session::class);
|
|
}
|
|
}
|