34 lines
849 B
PHP
34 lines
849 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\TenantEncrypted;
|
|
use App\Models\Concerns\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Str;
|
|
|
|
class DeviceAccessUser extends Model
|
|
{
|
|
use BelongsToTenant, SoftDeletes;
|
|
|
|
protected $fillable = ['tenant_id', 'display_name', 'username', 'password', 'is_enabled', 'notes', 'created_by', 'updated_by'];
|
|
|
|
protected $hidden = ['password'];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(fn (self $user) => $user->uuid ??= (string) Str::uuid());
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['password' => TenantEncrypted::class, 'is_enabled' => 'boolean'];
|
|
}
|
|
|
|
public function assignments()
|
|
{
|
|
return $this->hasMany(DeviceUserAssignment::class);
|
|
}
|
|
}
|