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');
|
||
|
|
}
|
||
|
|
}
|