Files
monica/app/Models/Streak.php

42 lines
849 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 list<string>
*/
protected $fillable = [
'goal_id',
'happened_at',
];
/**
* The attributes that should be cast to native types.
*
* @var array<string, string>
*/
protected $casts = [
'happened_at' => 'datetime',
];
/**
* Get the goal associated with the streak.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\Goal, $this>
*/
public function goal(): BelongsTo
{
return $this->belongsTo(Goal::class);
}
}