@php // $section is available from the page renderer // Default values for section content $sectionTitle = $section->content['title'] ?? 'Latest Job Openings'; $numberOfJobs = (int)($section->content['number_of_items'] ?? 3); $viewAllLink = $section->content['view_all_link'] ?? null; // e.g., '/jobs' $viewAllText = $section->content['view_all_text'] ?? 'View All Jobs'; // Fetch jobs from BusinessDirectory module try { $jobs = \Modules\BusinessDirectory\Entities\Job::query() ->where('status', 'open') // Assuming 'open' is the status for active jobs ->where(function ($query) { // Handle application deadline $query->whereNull('application_deadline') ->orWhere('application_deadline', '>=', now()); }) ->orderBy('created_at', 'desc') // Or a specific 'posted_at' date ->take($numberOfJobs) ->get(); } catch (\Throwable $e) { // Log error or handle gracefully if BusinessDirectory module/model isn't available $jobs = collect(); \Illuminate\Support\Facades\Log::error("Error fetching jobs for landing page section: " . $e->getMessage()); } @endphp @if($jobs->isNotEmpty())

{{ $sectionTitle }}

@foreach($jobs as $job)

{{ $job->title }}

Company: {{ $job->company->name ?? 'N/A' }}

Location: {{ $job->location ?? 'N/A' }}

{{ Str::limit($job->description ?? 'No description available.', 100) }}

{{-- Link to the job detail page (assuming a route exists in BusinessDirectory) --}} {{-- Example: route('businessdirectory.jobs.show', $job->slug) --}} Read More →
@endforeach
@if($viewAllLink) @endif
@endif