first commit

This commit is contained in:
Stefanescu Mihai
2026-03-18 10:56:35 +02:00
commit 18f43d0891
74 changed files with 11850 additions and 0 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers;
use App\Models\Website;
use Illuminate\Http\Response;
class TrackingScriptController extends Controller
{
public function script(string $trackingId): Response
{
$website = Website::where('tracking_id', $trackingId)
->where('is_active', true)
->first();
if (! $website) {
return response('', 404)
->header('Content-Type', 'application/javascript');
}
$collectUrl = route('collect.store');
$js = view('tracking.tracker', [
'trackingId' => $trackingId,
'collectUrl' => $collectUrl,
])->render();
return response($js)
->header('Content-Type', 'application/javascript')
->header('Cache-Control', 'public, max-age=3600');
}
}