mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
39 lines
826 B
PHP
39 lines
826 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class UserEmailVerification extends AbstractModel
|
|
{
|
|
protected $table = 'user_email_verifications';
|
|
|
|
public $fillable = [
|
|
'token', 'is_complete', 'is_active', 'is_sent'
|
|
];
|
|
/**
|
|
* @param $query
|
|
* @return mixed
|
|
*/
|
|
public function scopeActive($query){
|
|
return $query->where('is_active', true)->where('is_complete', false);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function user(): BelongsTo {
|
|
return $this->belongsTo(User::class, 'email', 'email');
|
|
}
|
|
|
|
/**
|
|
* @param $query
|
|
* @return mixed
|
|
*/
|
|
public function scopeTwoDaysOld($query)
|
|
{
|
|
return $query->where('created_at', '<=', Carbon::now()->subHours(48));
|
|
}
|
|
}
|