new :add classes required to send verification email after user registered. #1

This commit is contained in:
weichien00
2021-06-26 00:36:37 +08:00
parent d3fa2170f7
commit 0e1ea69515
8 changed files with 292 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
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');
}
}