<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use DateTimeInterface;
class UserClient extends Authenticatable
{
use HasApiTokens, Notifiable;
use LogsActivity;
protected $guard = 'client';
protected $fillable = [
'name',
'email',
'nuit',
'password',
'phone',
'status',
'api_token',
'url',
'session_status',
'url',
'institution',
'client_key',
'user_type'
];
protected static $logAttributes = [
'name',
'email',
'nuit',
'phone',
'status',
'api_token',
'url',
'api_token',
'session_status',
'url',
'institution',
'client_key',
'user_type'
];
protected $logAttribute = [
'name',
'email',
'nuit',
'phone',
'status',
'api_token',
'url',
'api_token',
'session_status',
'url',
'institution',
'client_key',
'user_type'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
protected $casts = [
'email_verified_at' => 'datetime',
];
public function getDescriptionForEvent(string $eventName): string
{
return "This model has been {$eventName}";
}
protected static $logName = 'userClientApi';
protected function serializeDate(DateTimeInterface $date)
{
return $date->format('d-m-Y H:i:s');
}
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logOnly($this->logAttribute);
}
}