@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DeviceUserAssignment extends Model
|
||||
{
|
||||
use BelongsToTenant;
|
||||
|
||||
protected $fillable = ['tenant_id', 'device_access_user_id', 'device_id', 'group_name', 'desired_operation', 'sync_status', 'remote_id', 'remote_username', 'error_code', 'message', 'attempts', 'last_attempted_at', 'last_synced_at'];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(fn (self $assignment) => $assignment->uuid ??= (string) Str::uuid());
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['last_attempted_at' => 'datetime', 'last_synced_at' => 'datetime'];
|
||||
}
|
||||
|
||||
public function accessUser()
|
||||
{
|
||||
return $this->belongsTo(DeviceAccessUser::class, 'device_access_user_id')->withTrashed();
|
||||
}
|
||||
|
||||
public function device()
|
||||
{
|
||||
return $this->belongsTo(Device::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user