mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Fix a problem where voucherify campaign vouchers limit not displaying with correct info for the month
This commit is contained in:
@@ -8,5 +8,5 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
interface KeyValueInterface
|
||||
{
|
||||
|
||||
public function attributes(): morphMany;
|
||||
public function attributesKVP(): morphMany;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class CreatesKeyValuePair extends AbstractUpdateRelationshipRecord
|
||||
$model->key = $object->getKey();
|
||||
$model->value = $object->getValue();
|
||||
|
||||
return $this->handler($kv->attributes(), $model);
|
||||
return $this->handler($kv->attributesKVP(), $model);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ class CreateVoucherLogic extends AbstractControllerLogic
|
||||
$key,
|
||||
$total
|
||||
);
|
||||
$metadata = $voucherCampaign->attributes()->where('key', $key)->first();
|
||||
$metadata = $voucherCampaign->attributesKVP()->where('key', $key)->first();
|
||||
if($metadata){
|
||||
$this->updatesKeyValuePair->execute($metadata, $keyValuePairObject);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class UserRewardResource extends JsonResource
|
||||
{
|
||||
$emailReminder = null;
|
||||
if ($request->has('isAdmin')) {
|
||||
$keyValuePairs = $this->user->attributes()->get();
|
||||
$keyValuePairs = $this->user->attributesKVP()->get();
|
||||
$emailReminder = KeyValueBasicResource::collection($keyValuePairs);
|
||||
$this->voucher->email = $emailReminder;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class VoucherCampaignResource extends JsonResource
|
||||
{
|
||||
$metadata = null;
|
||||
if ($request->has('include_metadata')) {
|
||||
$metadata = KeyValueBasicResource::collection($this->attributes);
|
||||
$metadata = KeyValueBasicResource::collection($this->attributesKVP()->latest()->get());
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ class User extends AbstractModel implements
|
||||
|
||||
public function hasAttribute(string $key, $value = null): bool
|
||||
{
|
||||
$query = $this->attributes()->where('key', $key);
|
||||
$query = $this->attributesKVP()->where('key', $key);
|
||||
|
||||
if ($value !== null) {
|
||||
$query->where('value', $value);
|
||||
@@ -116,7 +116,7 @@ class User extends AbstractModel implements
|
||||
}
|
||||
|
||||
|
||||
public function attributes(): MorphMany
|
||||
public function attributesKVP(): MorphMany
|
||||
{
|
||||
return $this->morphMany(KeyValuePair::class, 'owner');
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class VoucherCampaign extends AbstractModel implements KeyValueInterface
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attributes(): MorphMany
|
||||
public function attributesKVP(): MorphMany
|
||||
{
|
||||
return $this->morphMany(KeyValuePair::class, 'owner');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user