40 lines
818 B
PHP
40 lines
818 B
PHP
<?php
|
|
|
|
namespace Modules\ManagementTools\Entities;
|
|
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MtDailyReport extends Model
|
|
{
|
|
protected $table = 'mt_daily_reports';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'reported_at' => 'datetime',
|
|
'report_date' => 'date',
|
|
'submitted_at' => 'datetime',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function comments()
|
|
{
|
|
return $this->hasMany(MtDailyReportComment::class, 'daily_report_id');
|
|
}
|
|
|
|
public function userTask()
|
|
{
|
|
return $this->belongsTo(MtUserTask::class, 'mt_user_task_id');
|
|
}
|
|
|
|
public function scopeForBusiness($query, $business_id)
|
|
{
|
|
return $query->where('business_id', $business_id);
|
|
}
|
|
}
|