Commit
This commit is contained in:
@@ -13,4 +13,9 @@ class Department extends BaseModel
|
||||
'template_set', 'auto_ticket_response', 'auto_message_response',
|
||||
'auto_response_email', 'recipient', 'group_access', 'department_sign',
|
||||
];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class, 'dept_id', 'id');
|
||||
}
|
||||
}
|
||||
|
16
app/Model/helpdesk/Agent/Location.php
Normal file
16
app/Model/helpdesk/Agent/Location.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\helpdesk\Agent;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Location extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $primaryKey = 'locationid';
|
||||
public $incrementing = true;
|
||||
protected $keyType = 'int';
|
||||
|
||||
protected $fillable = ['locationname'];
|
||||
}
|
@@ -3,17 +3,46 @@
|
||||
namespace App\Model\helpdesk\Ticket;
|
||||
|
||||
use App\BaseModel;
|
||||
use App\Model\helpdesk\Agent\Location;
|
||||
|
||||
class Tickets extends BaseModel
|
||||
{
|
||||
protected $table = 'tickets';
|
||||
|
||||
protected $fillable = ['id', 'ticket_number', 'num_sequence', 'user_id', 'priority_id', 'sla', 'help_topic_id', 'max_open_ticket', 'captcha', 'status', 'lock_by', 'lock_at', 'source', 'isoverdue', 'reopened', 'isanswered', 'is_deleted', 'closed', 'is_transfer', 'transfer_at', 'reopened_at', 'duedate', 'closed_at', 'last_message_at', 'last_response_at', 'created_at', 'updated_at', 'assigned_to'];
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'ticket_number',
|
||||
'num_sequence',
|
||||
'user_id',
|
||||
'priority_id',
|
||||
'sla',
|
||||
'help_topic_id',
|
||||
'max_open_ticket',
|
||||
'captcha',
|
||||
'status',
|
||||
'lock_by',
|
||||
'lock_at',
|
||||
'source',
|
||||
'isoverdue',
|
||||
'reopened',
|
||||
'isanswered',
|
||||
'is_deleted',
|
||||
'closed',
|
||||
'is_transfer',
|
||||
'transfer_at',
|
||||
'reopened_at',
|
||||
'duedate',
|
||||
'closed_at',
|
||||
'last_message_at',
|
||||
'last_response_at',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'assigned_to',
|
||||
'locationid' // <-- Thêm locationid vào đây
|
||||
];
|
||||
|
||||
// Các quan hệ cũ...
|
||||
|
||||
// public function attach(){
|
||||
// return $this->hasMany('App\Model\helpdesk\Ticket\Ticket_attachments',);
|
||||
//
|
||||
// }
|
||||
public function thread()
|
||||
{
|
||||
return $this->hasMany(\App\Model\helpdesk\Ticket\Ticket_Thread::class, 'ticket_id');
|
||||
@@ -37,6 +66,12 @@ class Tickets extends BaseModel
|
||||
return $this->hasMany(\App\Model\helpdesk\Ticket\Ticket_Form_Data::class, 'ticket_id');
|
||||
}
|
||||
|
||||
// Thêm quan hệ location mới
|
||||
public function location()
|
||||
{
|
||||
return $this->belongsTo(Location::class, 'locationid', 'locationid');
|
||||
}
|
||||
|
||||
public function extraFields()
|
||||
{
|
||||
$id = $this->attributes['id'];
|
||||
|
Reference in New Issue
Block a user