56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Model\Pivot;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class IssueManagement extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'issue_managements';
|
|
|
|
protected $fillable = [
|
|
'location_id',
|
|
'sub_location_id',
|
|
'classification_id',
|
|
'sub_classification_id',
|
|
'media_monitoring_id',
|
|
'issue',
|
|
'response',
|
|
'description',
|
|
'enhancer_id',
|
|
];
|
|
|
|
public function location(){
|
|
return $this->belongsTo(Location::class, 'location_id', 'id');
|
|
}
|
|
public function subLocation(){
|
|
return $this->belongsTo(SubLocation::class, 'sub_location_id', 'id');
|
|
}
|
|
public function classification(){
|
|
return $this->belongsTo(Classification::class, 'classification_id', 'id');
|
|
}
|
|
public function subClassification(){
|
|
return $this->belongsTo(SubClassification::class, 'sub_classification_id', 'id');
|
|
}
|
|
|
|
public function mediaMonitoring(){
|
|
return $this->belongsTo(MediaMonitoring::class, 'media_monitoring_id', 'id');
|
|
}
|
|
|
|
public function governmentAgencies()
|
|
{
|
|
return $this->belongsToMany(GovernmentAgency::class, 'issue_managements_government_agencies', 'issue_management_id', 'government_agency_id')
|
|
->using(IssueManagementGovernmentAgency::class)
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function enhancer(){
|
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
|
}
|
|
|
|
}
|