list dan show appointment
This commit is contained in:
64
app/Models/OLDLMS/Livechat.php
Normal file
64
app/Models/OLDLMS/Livechat.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Livechat extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
public $sStatusNames = [
|
||||
0 => 'Menunggu Konfirmasi',
|
||||
1 => 'Diterima',
|
||||
2 => 'Ditolak',
|
||||
3 => 'Selesai',
|
||||
4 => 'Dibatalkan',
|
||||
];
|
||||
|
||||
const CREATED_AT = 'dCreateOn';
|
||||
const UPDATED_AT = 'dUpdateOn';
|
||||
const DELETED_AT = 'dDeleteOn';
|
||||
|
||||
protected $connection = 'oldlms';
|
||||
|
||||
protected $table = 'tx_livechat';
|
||||
|
||||
protected $appends = [
|
||||
'status_name',
|
||||
];
|
||||
|
||||
protected function StatusName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function ($value) {
|
||||
return $this->sStatusNames[$this->sStatus] ?? '-';
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'nIDUser', 'nID');
|
||||
}
|
||||
|
||||
public function doctor()
|
||||
{
|
||||
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');
|
||||
}
|
||||
|
||||
|
||||
public function appointment()
|
||||
{
|
||||
return $this->belongsTo(Appointment::class, 'nIDAppointment', 'nID');
|
||||
}
|
||||
|
||||
public function healthCare()
|
||||
{
|
||||
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user