Added quiz new features

This commit is contained in:
m.razaghi
2026-08-19 12:18:35 +03:30
parent f84ef8c067
commit a6b2a1ba30
11 changed files with 549 additions and 0 deletions

35
app/Models/UserQuest.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserQuest extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'daily_quest_id',
'current_progress',
'is_completed',
'expires_at',
];
// Casts ensure Laravel automatically converts these to the right data types
protected $casts = [
'is_completed' => 'boolean',
'expires_at' => 'datetime',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function quest()
{
return $this->belongsTo(DailyQuest::class, 'daily_quest_id');
}
}