flexisip-account-manager/flexiapi/app/AuthToken.php
Timothée Jaussoin 354830da7e QRCode based authentication
Add routes, model and controller for AuthToken
Create auth_tokens table
Allow auth_token to be used for provisioning
Reorganize the API
Update the dependencies
2022-07-12 15:14:46 +02:00

24 lines
480 B
PHP

<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AuthToken extends Model
{
use HasFactory;
public static $expirationMinutes = 5;
public function account()
{
return $this->belongsTo('App\Account');
}
public function scopeValid($query)
{
return $query->where('created_at', '>', Carbon::now()->subMinutes(self::$expirationMinutes));
}
}