75 lines
1.6 KiB
PHP
75 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Modules\DailyReports\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Modules\ProjectManagement\Models\Project;
|
|
use App\Models\User;
|
|
use Spatie\MediaLibrary\HasMedia;
|
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
|
|
|
class DailyReport extends Model implements HasMedia
|
|
{
|
|
use HasFactory, InteractsWithMedia;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected $fillable = [
|
|
'project_id',
|
|
'user_id',
|
|
'report_number',
|
|
'report_date',
|
|
'temperature',
|
|
'precipitation',
|
|
'wind',
|
|
'weather',
|
|
'start_time',
|
|
'end_time',
|
|
'work_accomplished',
|
|
'remarks',
|
|
];
|
|
|
|
protected $casts = [
|
|
'report_date' => 'date',
|
|
];
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function labors(): HasMany
|
|
{
|
|
return $this->hasMany(DailyReportLabor::class);
|
|
}
|
|
|
|
public function equipment(): HasMany
|
|
{
|
|
return $this->hasMany(DailyReportEquipment::class);
|
|
}
|
|
|
|
public function activities(): HasMany
|
|
{
|
|
return $this->hasMany(DailyReportActivity::class);
|
|
}
|
|
|
|
public function materials(): HasMany
|
|
{
|
|
return $this->hasMany(DailyReportMaterial::class);
|
|
}
|
|
|
|
public function issues(): HasMany
|
|
{
|
|
return $this->hasMany(DailyReportIssue::class);
|
|
}
|
|
}
|