@php // $section is available from the page renderer // Default values for section content $sectionTitle = $section->content['title'] ?? 'Recent Company Projects'; $numberOfProjects = (int)($section->content['number_of_items'] ?? 3); // Example: Allow filtering by status, e.g., 'completed', 'in_progress' $projectStatus = $section->content['project_status'] ?? 'completed'; $viewAllLink = $section->content['view_all_link'] ?? null; // e.g., '/company-projects' $viewAllText = $section->content['view_all_text'] ?? 'View All Projects'; // Fetch company projects from BusinessDirectory module try { $projectsQuery = \Modules\BusinessDirectory\Entities\CompanyProject::query() ->with('company'); // Eager load the company if (!empty($projectStatus) && $projectStatus !== 'all') { $projectsQuery->where('status', $projectStatus); } $projects = $projectsQuery ->orderBy('end_date', 'desc') // Show recently completed/updated first ->take($numberOfProjects) ->get(); } catch (\Throwable $e) { $projects = collect(); \Illuminate\Support\Facades\Log::error("Error fetching company projects for landing page section: " . $e->getMessage()); } @endphp @if($projects->isNotEmpty())

{{ $sectionTitle }}

@foreach($projects as $project)

{{ $project->name }}

@if($project->company)

By: {{ $project->company->name }}

@endif

Status: {{ Str::title(str_replace('_', ' ', $project->status)) }}

{{ Str::limit($project->description ?? 'Project description unavailable.', 120) }}

View Project Details →
@endforeach
@if($viewAllLink) @endif
@endif