update
This commit is contained in:
42
app/Models/UserAchievement.php
Normal file
42
app/Models/UserAchievement.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use App\Models\Achievement;
|
||||
|
||||
class UserAchievement extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'achievement_id',
|
||||
'unlocked_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 'integer',
|
||||
'achievement_id' => 'integer',
|
||||
'unlocked_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function achievement(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Achievement::class, 'achievement_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user