37 lines
765 B
PHP
37 lines
765 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Goal extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_ACTIVE = 'active';
|
|
public const STATUS_PAUSED = 'paused';
|
|
public const STATUS_DONE = 'done';
|
|
public const STATUS_ABANDONED = 'abandoned';
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'description',
|
|
'status',
|
|
'progress',
|
|
'metadata',
|
|
'last_reviewed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'metadata' => 'array',
|
|
'last_reviewed_at' => 'datetime',
|
|
'progress' => 'integer',
|
|
];
|
|
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('status', self::STATUS_ACTIVE);
|
|
}
|
|
}
|