30 lines
845 B
PHP
Executable File
30 lines
845 B
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Http\Controllers;
|
|
|
|
use Illuminate\Http\Response;
|
|
use Modules\Helpdesk\Models\WorkflowLog;
|
|
|
|
final class WorkflowOpenController
|
|
{
|
|
public function __invoke(string $token): Response
|
|
{
|
|
$log = WorkflowLog::query()->where('tracking_token', $token)->first();
|
|
|
|
if ($log) {
|
|
$log->forceFill([
|
|
'first_opened_at' => $log->first_opened_at ?? now(),
|
|
'last_opened_at' => now(),
|
|
'opened_count' => ((int) $log->opened_count) + 1,
|
|
])->save();
|
|
}
|
|
|
|
return response(base64_decode('R0lGODlhAQABAPAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='), 200, [
|
|
'Content-Type' => 'image/gif',
|
|
'Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0',
|
|
]);
|
|
}
|
|
}
|