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
69 lines
1.3 KiB
PHP
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);
|
|
}
|
|
}
|