Files
monica/app/Models/Streak.php
T

42 lines
751 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Streak extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'goal_id',
'happened_at',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'happened_at',
];
/**
* Get the goal associated with the streak.
*
* @return BelongsTo
*/
public function goal(): BelongsTo
{
return $this->belongsTo(Goal::class);
}
}