- PMIS 모델 21개 + DailyWorkLog 2개에 $connection = 'codebridge' 추가 - MNG 마이그레이션 파일 18개 전체 삭제 (API에서 관리) - 원칙: MNG는 마이그레이션 파일을 생성하지 않고 API에서만 관리
74 lines
1.8 KiB
PHP
74 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Juil;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PmisDailyWorkReport extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $connection = 'codebridge';
|
|
|
|
protected $table = 'pmis_daily_work_reports';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'date',
|
|
'company_name',
|
|
'weather',
|
|
'temp_low',
|
|
'temp_high',
|
|
'precipitation',
|
|
'snowfall',
|
|
'fine_dust',
|
|
'ultra_fine_dust',
|
|
'work_content_today',
|
|
'work_content_tomorrow',
|
|
'notes',
|
|
'status',
|
|
'options',
|
|
];
|
|
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
'temp_low' => 'decimal:1',
|
|
'temp_high' => 'decimal:1',
|
|
'precipitation' => 'decimal:1',
|
|
'snowfall' => 'decimal:1',
|
|
'options' => 'array',
|
|
];
|
|
|
|
public function scopeTenant($query, $tenantId)
|
|
{
|
|
return $query->where('tenant_id', $tenantId);
|
|
}
|
|
|
|
public function workers(): HasMany
|
|
{
|
|
return $this->hasMany(PmisWorkReportWorker::class, 'report_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function equipments(): HasMany
|
|
{
|
|
return $this->hasMany(PmisWorkReportEquipment::class, 'report_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function materials(): HasMany
|
|
{
|
|
return $this->hasMany(PmisWorkReportMaterial::class, 'report_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function volumes(): HasMany
|
|
{
|
|
return $this->hasMany(PmisWorkReportVolume::class, 'report_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function photos(): HasMany
|
|
{
|
|
return $this->hasMany(PmisWorkReportPhoto::class, 'report_id')->orderBy('sort_order');
|
|
}
|
|
}
|