50 lines
1 KiB
PHP
50 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Auth;
|
|
|
|
use DateTimeImmutable;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property string $token
|
|
* @property int $user_id
|
|
* @property DateTimeImmutable $created_at
|
|
* @property DateTimeImmutable $expires_at
|
|
*
|
|
* @method static Builder<static>|SessionModel newModelQuery()
|
|
* @method static Builder<static>|SessionModel newQuery()
|
|
* @method static Builder<static>|SessionModel query()
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
#[Fillable([
|
|
'token',
|
|
'user_id',
|
|
'created_at',
|
|
'expires_at',
|
|
])]
|
|
class SessionModel extends Model
|
|
{
|
|
protected $table = 'sessions';
|
|
|
|
protected $primaryKey = 'token';
|
|
|
|
public $incrementing = false;
|
|
|
|
protected $keyType = 'string';
|
|
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'created_at' => 'datetime',
|
|
'expires_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|