Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Functional\Streaks\Models;
|
||||
|
||||
use Functional\Streaks\Database\Factories\GoalFactory;
|
||||
use Functional\Streaks\Enums\GoalPeriod;
|
||||
use Functional\Streaks\Enums\GoalType;
|
||||
use Functional\Users\Models\User;
|
||||
use Illuminate\Database\Eloquent\Attributes\UseFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Objectif hebdomadaire fixé par le user (nombre de séances, minutes ou volume).
|
||||
*
|
||||
* @property int $user_id
|
||||
* @property GoalType $type
|
||||
* @property int $target
|
||||
* @property GoalPeriod $period
|
||||
* @property bool $is_active
|
||||
*/
|
||||
#[UseFactory(GoalFactory::class)]
|
||||
class Goal extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id', 'type', 'target', 'period', 'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => GoalType::class,
|
||||
'target' => 'integer',
|
||||
'period' => GoalPeriod::class,
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user