mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 23:21:06 +03:30
38 lines
822 B
PHP
38 lines
822 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Input extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public $fillable = [
|
|
'name', 'type', 'size', 'test_type_id', 'parent_id', 'require_scanner'
|
|
];
|
|
|
|
public function test_type(): BelongsTo
|
|
{
|
|
return $this->belongsTo(TestType::class);
|
|
}
|
|
|
|
public function parent(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Input::class, 'parent_id');
|
|
}
|
|
|
|
public function children(): HasMany
|
|
{
|
|
return $this->hasMany(Input::class, 'parent_id');
|
|
}
|
|
|
|
public function options(): HasMany
|
|
{
|
|
return $this->hasMany(Option::class);
|
|
}
|
|
}
|