crud room, incident type, catalog, and sample-containers
This commit is contained in:
48
app/Models/ContainerType.php
Normal file
48
app/Models/ContainerType.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
use App\Enums\RecordStatusEnum;
|
||||
use App\Models\Traits\HasLocalizedName;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Traits\AuditLogTrait;
|
||||
|
||||
class ContainerType extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
use HasFactory;
|
||||
use HasLocalizedName;
|
||||
use AuditLogTrait;
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $appends = ['name'];
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'container_type_concept_id','sample_type_concept_id', 'additive', 'cap_color', 'volume_ml', 'storage_temp', 'sterile',
|
||||
BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD,
|
||||
BaseModel::DELETED_AT_FIELD, BaseModel::DELETED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function sampleType(){
|
||||
return $this->belongsTo(Concept::class, 'sample_type_concept_id', 'id');
|
||||
}
|
||||
|
||||
public function containerName(){
|
||||
return $this->belongsTo(Concept::class, 'container_type_concept_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
40
app/Models/IncidentType.php
Normal file
40
app/Models/IncidentType.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
use App\Enums\RecordStatusEnum;
|
||||
use App\Models\Traits\HasLocalizedName;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Traits\AuditLogTrait;
|
||||
|
||||
class IncidentType extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
use HasFactory;
|
||||
use HasLocalizedName;
|
||||
use AuditLogTrait;
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $appends = ['name'];
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'name_en','name_kh', 'description',
|
||||
BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD,
|
||||
BaseModel::DELETED_AT_FIELD, BaseModel::DELETED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class Room extends BaseModel
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'name_en','name_kh', 'description', 'organization_id',
|
||||
'code', 'name_en','name_kh', 'description', 'biosafety_level_concept_id', 'building_id', 'temperature_range', 'organization_id',
|
||||
BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD,
|
||||
BaseModel::DELETED_AT_FIELD, BaseModel::DELETED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD
|
||||
];
|
||||
@@ -36,5 +36,13 @@ class Room extends BaseModel
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function building(){
|
||||
return $this->belongsTo(Building::class, 'building_id', 'id');
|
||||
}
|
||||
|
||||
public function bsl(){
|
||||
return $this->belongsTo(Concept::class, 'biosafety_level_concept_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user