init project

This commit is contained in:
2026-05-25 11:08:52 +07:00
parent a388c619b5
commit 895fdd9b83
1437 changed files with 384844 additions and 27 deletions

63
app/Models/TestSample.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
namespace App\Models;
use App\Enums\RecordStatusEnum;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Session;
class TestSample extends BaseModel
{
public $timestamps = false;
use HasFactory;
/**
* The table associated with the model.
*
* @var string
*/
protected $table='test_samples';
public static function boot()
{
parent::boot();
}
protected $fillable = ['sample_type_id', 'test_id','heading_id', 'group_result','category', 'code',
'unit_sign','usd_price', 'weight', 'lab_id','field_type', 'formula', 'format',
'description','is_bold','autocomplete_bind', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD];
public function test(){
return $this->belongsTo(Test::class, 'test_id','id');
}
public function sample(){
return $this->belongsTo(SampleType::class, 'sample_type_id','id');
}
public function lab(){
return $this->belongsTo(Laboratory::class, 'lab_id','id');
}
public function organisms(){
return $this->hasMany(TestSampleOrganism::class, 'test_sample_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
}
public function tests(){
return $this->hasMany(self::class, 'heading_id','id')->where([
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
'lab_id' => Session::get('base_lab_id')
]);
}
public function childTest(){
return $this->hasMany(self::class, 'heading_id','id')->where([
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
'lab_id' => Session::get('base_lab_id')
]);
}
public function testValues(){
return $this->hasMany(TestNormalValue::class, 'test_sample_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
}
}