Files
jobifygarden/app/Http/Controllers/Web/HomeController.php
T

44 lines
1.2 KiB
PHP
Raw Normal View History

2026-04-03 01:04:19 +03:00
<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\JobCategory;
use App\Repositories\JobRepository;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function __construct(
private JobRepository $jobRepository
) {}
/**
* Display the homepage with featured jobs
*/
public function index()
{
$featuredJobs = $this->jobRepository->getFeaturedJobs(10);
$recentJobs = $this->jobRepository->getRecentJobs(7, 6);
$stats = $this->jobRepository->getStatistics();
$categories = JobCategory::withCount('jobs')
->orderBy('name')
->get();
2026-04-04 18:19:34 +03:00
// Get filter options for search form
$jobTypes = \App\Models\Job::select('job_type')
->whereNotNull('job_type')
->distinct()
->pluck('job_type')
->toArray();
$experienceLevels = \App\Models\Job::select('experience_level')
->whereNotNull('experience_level')
->distinct()
->pluck('experience_level')
->toArray();
return view('home', compact('featuredJobs', 'recentJobs', 'stats', 'categories', 'jobTypes', 'experienceLevels'));
2026-04-03 01:04:19 +03:00
}
}