feat: add app and database modules
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Prunable;
|
||||
|
||||
class UserTrustedDevice extends Model
|
||||
{
|
||||
use Prunable;
|
||||
|
||||
protected $fillable = ['user_id', 'device_id', 'token', 'expires_at'];
|
||||
|
||||
protected $casts = [
|
||||
'expires_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function prunable(): Builder
|
||||
{
|
||||
return self::query()->where('expires_at', '<', now());
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user