phase 5
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user