Files
hub/app/Models/EmailVerification.php
Jon Leopard 7e5ea2bc10 checkpoint: marketplace and operational features complete, ready for Week 4 data migration
Summary of completed work:
- Complete buyer portal (browse, cart, checkout, orders, invoices)
- Complete seller portal (orders, manifests, fleet, picking)
- Business onboarding wizards (buyer 4-step, seller 5-step)
- Email verification and registration flows
- Notification system for buyers and sellers
- Payment term surcharges and pickup/delivery workflows
- Filament admin resources (Business, Brand, Product, Order, Invoice, User)
- 51 migrations executed successfully

Renamed Company -> Business throughout codebase for consistency.
Unified authentication flows with password reset.
Added audit trail and telescope for debugging.

Next: Week 4 Data Migration (Days 22-28)
- Product migration (883 products from cannabrands_crm)
- Company migration (81 buyer companies)
- User migration (preserve password hashes)
- Order history migration
2025-10-15 11:17:15 -07:00

69 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class EmailVerification extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'email',
'token',
'expires_at',
'metadata',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'expires_at' => 'datetime',
'metadata' => 'array',
];
/**
* Check if the verification token has expired
*
* @return bool
*/
public function isExpired(): bool
{
return $this->expires_at->isPast();
}
/**
* Check if the verification token is still valid
*
* @return bool
*/
public function isValid(): bool
{
return !$this->isExpired();
}
/**
* Get the time remaining before expiration
*
* @return \Carbon\CarbonInterval|null
*/
public function timeRemaining(): ?\Carbon\CarbonInterval
{
if ($this->isExpired()) {
return null;
}
return Carbon::now()->diffAsCarbonInterval($this->expires_at);
}
}