mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-28 08:53:59 +00:00
Send welcome email with voucher to user upon successful verification of customer email adddress
This commit is contained in:
+20
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\KeyValueInterface;
|
||||
use App\Classes\General\Interfaces\Voucherifiable;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -26,7 +27,8 @@ class User extends AbstractModel implements
|
||||
AuthenticatableContract,
|
||||
AuthorizableContract,
|
||||
CanResetPasswordContract,
|
||||
Voucherifiable
|
||||
Voucherifiable,
|
||||
KeyValueInterface
|
||||
{
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
||||
|
||||
@@ -101,4 +103,21 @@ class User extends AbstractModel implements
|
||||
{
|
||||
return $this->HasMany(UserReward::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function hasAttribute(string $key, $value = null): bool
|
||||
{
|
||||
$query = $this->attributes()->where('key', $key);
|
||||
|
||||
if ($value !== null) {
|
||||
$query->where('value', $value);
|
||||
}
|
||||
|
||||
return $query->exists();
|
||||
}
|
||||
|
||||
|
||||
public function attributes(): MorphMany
|
||||
{
|
||||
return $this->morphMany(KeyValuePair::class, 'owner');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user