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

31 lines
577 B
PHP

<?php
namespace App\Http\Controllers;
use Throwable;
use function Sentry\captureException;
abstract class HashidActionControllerBase extends Controller
{
protected ?int $key = null;
protected ?string $hashid = null;
public function __invoke()
{
$this->hashid = request('hashid');
try {
$this->key = unhash_it($this->hashid);
} catch (Throwable $exception) {
captureException($exception);
abort(404);
}
return $this->handle();
}
abstract protected function handle();
}