- 마스터 + 인원/장비/자재/공사량/작업사진 6테이블 마이그레이션 - 6개 탭: 작업내용, 인원, 장비, 자재, 공사량, 작업사진 - 작업내용: 금일/명일 텍스트 + 날씨/기온/강수/미세먼지 메타 - 전일누계 + 금일 + 총계 누적 패턴 (인원/장비/자재/공사량) - 작업사진: 파일 업로드 + 사진목록/사진정보 2단 레이아웃 - 상태별 버튼 제어 (작성중→저장/삭제, 검토중→읽기전용) - 양식보기: 3페이지 전체화면 뷰어 (작업일보/인원장비/자재) - 검토자 지정 모달, 캘린더 스트립, 번개 랜덤데이터
72 lines
1.7 KiB
PHP
72 lines
1.7 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 $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');
|
|
}
|
|
}
|