31 lines
794 B
PHP
31 lines
794 B
PHP
<?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();
|
||
|
|
|
||
|
|
return view('home', compact('featuredJobs', 'recentJobs', 'stats', 'categories'));
|
||
|
|
}
|
||
|
|
}
|