38 lines
695 B
PHP
38 lines
695 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class TenantSetupToken extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $connection = 'sqlite';
|
|
protected $table = 'tenant_setup_tokens';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'email',
|
|
'token_hash',
|
|
'expires_at',
|
|
'used_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'expires_at' => 'datetime',
|
|
'used_at' => 'datetime',
|
|
];
|
|
|
|
public function isExpired(): bool
|
|
{
|
|
return $this->expires_at->isPast();
|
|
}
|
|
|
|
public function isUsed(): bool
|
|
{
|
|
return !is_null($this->used_at);
|
|
}
|
|
}
|