50 lines
1003 B
PHP
50 lines
1003 B
PHP
<?php
|
|
|
|
namespace Modules\AssetExchange\Models;
|
|
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ResearchCase extends Model
|
|
{
|
|
protected $table = 'aex_research_cases';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'listing_id',
|
|
'case_code',
|
|
'title',
|
|
'status',
|
|
'lead_researcher_id',
|
|
'summary',
|
|
'started_at',
|
|
'closed_at',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'started_at' => 'datetime',
|
|
'closed_at' => 'datetime',
|
|
];
|
|
|
|
public function listing()
|
|
{
|
|
return $this->belongsTo(Listing::class, 'listing_id');
|
|
}
|
|
|
|
public function tasks()
|
|
{
|
|
return $this->hasMany(ResearchTask::class, 'research_case_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function leadResearcher()
|
|
{
|
|
return $this->belongsTo(User::class, 'lead_researcher_id');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|