23 lines
442 B
PHP
23 lines
442 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use Illuminate\Support\Facades\Crypt;
|
|
use Illuminate\Contracts\Encryption\DecryptException;
|
|
|
|
class EncryptionHelper
|
|
{
|
|
public static function encryptId($id)
|
|
{
|
|
return Crypt::encrypt($id);
|
|
}
|
|
|
|
public static function decryptId($encryptedId)
|
|
{
|
|
try {
|
|
return Crypt::decrypt($encryptedId);
|
|
} catch (DecryptException $e) {
|
|
return null;
|
|
}
|
|
}
|
|
} |