radfusion/app/Http/Controllers/HashidControllerBase.php
2025-01-05 12:57:50 +06:00

34 lines
686 B
PHP

<?php
namespace App\Http\Controllers;
use Throwable;
use function Sentry\captureException as gobble;
abstract class HashidControllerBase extends Controller
{
protected ?int $key = null;
protected ?string $hashid = null;
protected function decodeKeys(): void
{
$this->hashid = request('hashid');
$this->decodeHashid($this->hashid);
}
protected function decodeHashId(?string $hashid): void
{
if (! blank($hashid)) {
try {
$this->key = unhash_it($hashid);
} catch (Throwable $exc) {
gobble($exc);
}
}
abort_if($this->key === null, 404);
}
}