Add Additional Information

This commit is contained in:
R
2023-02-15 09:57:00 +07:00
parent 7f77deb09e
commit d8f493103c
6 changed files with 65 additions and 16 deletions

View File

@@ -50,15 +50,13 @@ class Appointment extends Model
'dUpdateOn',
'dDeleteOn',
];
protected $appends = [
'status_name',
'payment_method'
];
protected function StatusName(): Attribute
protected function statusName(): Attribute
{
return Attribute::make(
get: function ($value) {
@@ -67,7 +65,7 @@ class Appointment extends Model
);
}
protected function PaymentMethod(): Attribute
protected function paymentMethod(): Attribute
{
return Attribute::make(
get: function ($value) {

View File

@@ -31,7 +31,7 @@ class Livechat extends Model
'status_name',
];
protected function StatusName(): Attribute
protected function statusName(): Attribute
{
return Attribute::make(
get: function ($value) {

View File

@@ -2,6 +2,7 @@
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -17,4 +18,25 @@ class User extends Model
protected $connection = 'oldlms';
protected $table = 'tm_users';
protected $appends = [
'full_name',
];
protected function fullName(): Attribute
{
return Attribute::make(
get: function ($value) {
$names = [];
if (!empty($this->sFirstName)) {
array_push($names, $this->sFirstName);
}
if (!empty($this->sLastName)) {
array_push($names, $this->sLastName);
}
return implode(' ', $names);
}
);
}
}