add auth sessions
This commit is contained in:
parent
a37c8da555
commit
34e26f81f5
9 changed files with 243 additions and 0 deletions
50
backend/app/Auth/SessionModel.php
Normal file
50
backend/app/Auth/SessionModel.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Auth;
|
||||
|
||||
use Carbon\CarbonInterface;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property string $token
|
||||
* @property int $user_id
|
||||
* @property CarbonInterface $created_at
|
||||
* @property CarbonInterface $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 = 'auth_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',
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue