This commit is contained in:
kevin
2023-08-14 16:55:34 +07:00
parent f05a2c879e
commit db4b0193dd
10 changed files with 1043 additions and 405 deletions

View File

@@ -0,0 +1,35 @@
<?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;
}
}