Files
aso/app/Models/OLDLMS/DoctorRating.php
2023-08-14 16:55:34 +07:00

36 lines
894 B
PHP

<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class DoctorRating extends Model
{
use HasFactory;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tx_dokter_rating';
// Define a belongsTo relationship with the User model
public function user()
{
return $this->belongsTo(User::class, 'nIDUser');
}
// Include additional fields in the model's JSON form
protected $appends = [
'user_first_name', // Include the attribute for user's first name
];
// Define an accessor to get the first name of the related user
public function getUserFirstNameAttribute()
{
return $this->user ? $this->user->sFirstName : null;
}
}