41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Spatie\Activitylog\Traits\LogsActivity;
|
|
use Spatie\Activitylog\LogOptions;
|
|
|
|
class ClientNote extends Model
|
|
{
|
|
protected $guarded = array('id');
|
|
protected static $logUnguarded = true;
|
|
|
|
// public function getActivitylogOptions(): LogOptions{
|
|
// return LogOptions::defaults()->logUnguarded();
|
|
// }
|
|
|
|
public function client_info(){
|
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
|
}
|
|
public function created_by_info(){
|
|
return $this->hasOne('App\Models\SystemUser', 'id', 'auth_user_id');
|
|
}
|
|
protected $casts = [
|
|
'services' => 'array',
|
|
];
|
|
|
|
public function getServiceNamesAttribute()
|
|
{
|
|
if (empty($this->services) || !is_array($this->services)) {
|
|
return collect();
|
|
}
|
|
return \App\Models\Service::whereIn('id', $this->services)->pluck('name');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(App\Models\User::class);
|
|
}
|
|
}
|