This commit is contained in:
Doar Mihai
2026-04-03 20:41:35 +03:00
parent 19d5e23dfd
commit a8a48f3f6f
13 changed files with 1185 additions and 0 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\AnalyticsEvent;
use App\Models\Job;
use App\Models\JobCategory;
use App\Repositories\JobRepository;
@@ -35,6 +36,11 @@ class JobController extends Controller
'sort',
]);
// Track search event if keywords are provided
if (!empty($filters['keywords'])) {
AnalyticsEvent::logEvent(AnalyticsEvent::EVENT_SEARCH, null, $filters);
}
$perPage = $request->input('per_page', 20);
$jobs = $this->searchService->search($filters, $perPage);
@@ -52,6 +58,9 @@ class JobController extends Controller
$job = Job::with(['source', 'category', 'jobLocation'])
->findOrFail($id);
// Track job view event
AnalyticsEvent::logEvent(AnalyticsEvent::EVENT_JOB_VIEW, $job->id);
$similarJobs = $this->jobRepository->getSimilarJobs($job, 5);
return view('jobs.show', compact('job', 'similarJobs'));
@@ -64,6 +73,9 @@ class JobController extends Controller
{
$category = JobCategory::where('slug', $slug)->firstOrFail();
// Track category view event
AnalyticsEvent::logEvent(AnalyticsEvent::EVENT_CATEGORY_VIEW, null, ['category' => $category->name]);
$filters = $request->only([
'keywords',
'location',