34 lines
656 B
PHP
34 lines
656 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MagicLink extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'token_hash',
|
|
'purpose',
|
|
'payload',
|
|
'expires_at',
|
|
'consumed_at',
|
|
'ip_requested',
|
|
'ip_consumed',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'payload' => 'array',
|
|
'expires_at' => 'datetime',
|
|
'consumed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|