freescout2ant/Entities/AmeiseToken.php
2025-04-21 13:18:51 +02:00

41 lines
1,013 B
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Modules\AmeiseModule\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Facades\Crypt;
class AmeiseToken extends Model
{
use HasFactory;
protected $fillable = [
'access_token',
'refresh_token',
'expires_at',
];
protected $casts = [
'expires_at' => 'datetime',
];
/** AccessToken automatisch ver/ent­schlüsseln */
protected function accessToken(): Attribute
{
return Attribute::make(
get: fn ($v) => Crypt::decryptString($v),
set: fn ($v) => Crypt::encryptString($v)
);
}
/** RefreshToken automatisch ver/ent­schlüsseln */
protected function refreshToken(): Attribute
{
return Attribute::make(
get: fn ($v) => Crypt::decryptString($v),
set: fn ($v) => Crypt::encryptString($v)
);
}
}