phase 7
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user