api code global jain

This commit is contained in:
Abhishek Mali
2025-11-05 10:37:10 +05:30
commit 52fe7e2bec
2834 changed files with 1784903 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Traits;
use App\Models\User;
use Illuminate\Support\Facades\Log;
trait HasKarmaPoint
{
public function addKarmaPoints($model, $userId, string $message, $points, string $key, array $properties)
{
// dd($model, $userId, $message, $points, $key, $properties);
$model->addPoints()->create([
'user_id' => $userId,
'message' => $message,
'points' => $points,
'key' => $key,
'trasaction_type' => 'credit',
'properties' => $properties,
]);
if ($model instanceof User) {
User::find($userId)->increment('karma_dhan', $points);
}
}
public function revokeKarmaPoints()
{
//
}
}