2022-07-26 06:36:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Message extends Model
|
|
|
|
|
{
|
|
|
|
|
use CrudTrait;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| GLOBAL VARIABLES
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected $table = 'messages';
|
|
|
|
|
// protected $primaryKey = 'id';
|
|
|
|
|
// public $timestamps = false;
|
2022-10-04 11:38:38 +00:00
|
|
|
// protected $guarded = ['id'];
|
2022-07-26 06:36:47 +00:00
|
|
|
protected $fillable = [
|
2022-10-04 11:38:38 +00:00
|
|
|
'content', 'ticket_id', 'is_client', 'admin_id', 'client_id'
|
2022-07-26 06:36:47 +00:00
|
|
|
];
|
|
|
|
|
// protected $hidden = [];
|
|
|
|
|
// protected $dates = [];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| FUNCTIONS
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| RELATIONS
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
2022-07-29 10:32:39 +00:00
|
|
|
public function ticket(){
|
|
|
|
|
return $this->belongsTo(Ticket::class, 'ticket_id');
|
|
|
|
|
}
|
2022-07-26 06:36:47 +00:00
|
|
|
|
2022-08-11 06:59:04 +00:00
|
|
|
public function admin(){
|
|
|
|
|
return $this->belongsTo(User::class, 'admin_id');
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-04 11:38:38 +00:00
|
|
|
public function client(){
|
|
|
|
|
return $this->belongsTo(Client::class, 'client_id');
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-26 06:36:47 +00:00
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| SCOPES
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| ACCESSORS
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| MUTATORS
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
}
|