Added Notifications

This commit is contained in:
2026-05-18 14:31:53 +10:00
parent 1d5b9f340f
commit 10b5b6a5c9
18 changed files with 545 additions and 166 deletions
+16
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -26,6 +27,21 @@ class UserAchievement extends Model
'progress' => 'integer',
];
protected $appends = [
'unlocked',
];
protected function unlocked(): Attribute
{
return Attribute::make(
get: function () {
if (!$this->achievement) return false;
if (!$this->achievement->progressive || !$this->achievement->threshold) return true;
return ($this->progress ?? 0) >= $this->achievement->threshold;
}
);
}
// ---------------------------------------------------------------
// Relationships
// ---------------------------------------------------------------