authentikate/app/Models/Invitation.php
Javier Feliz 93c6baa16b
Some checks failed
linter / quality (push) Successful in 3m5s
tests / ci (push) Failing after 7m45s
Invites and some tests
2025-08-01 21:33:43 -04:00

31 lines
561 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Invitation extends Model
{
protected $guarded = ['id'];
protected $casts = [
'expires_at' => 'datetime',
'accepted_at' => 'datetime'
];
public function status(): string
{
return !empty($this->accepted_at) ? 'accepted' : 'pending';
}
public function isPending(): bool
{
return empty($this->accepted_at);
}
public function accept(): void
{
$this->accepted_at = now();
$this->save();
}
}