Rabbi_Gerzi/backend/database/SessionModel.php

34 lines
639 B
PHP

<?php
namespace App\Database;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SessionModel extends Model
{
protected $table = 'sessions';
public $timestamps = false;
protected $primaryKey = 'token';
public $incrementing = false;
protected $fillable = [
'token',
'user_id',
'expires_at',
'created_at',
];
protected $casts = [
'expires_at' => 'datetime',
'created_at' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(UserModel::class, 'user_id');
}
}