@php // $section is available from the page renderer // Default values for section content $sectionTitle = $section->content['title'] ?? 'Featured Companies'; $numberOfCompanies = (int)($section->content['number_of_items'] ?? 4); $displayType = $section->content['display_type'] ?? 'featured'; // 'featured' or 'latest' $viewAllLink = $section->content['view_all_link'] ?? null; // e.g., '/companies' $viewAllText = $section->content['view_all_text'] ?? 'View All Companies'; // Fetch companies from BusinessDirectory module try { $companiesQuery = \Modules\BusinessDirectory\Entities\Company::query() ->where('status', 'approved'); // Assuming 'approved' or 'active' is the status for visible companies if ($displayType === 'featured') { $companiesQuery->where('is_featured', true); } $companies = $companiesQuery ->orderBy('created_at', 'desc') // Or by name, or a specific order field ->take($numberOfCompanies) ->get(); } catch (\Throwable $e) { $companies = collect(); \Illuminate\Support\Facades\Log::error("Error fetching companies for landing page section: " . $e->getMessage()); } @endphp @if($companies->isNotEmpty())

{{ $sectionTitle }}

@foreach($companies as $company)
@if($company->logo) {{ $company->name }} Logo @else
No Logo
@endif

{{ $company->name }}

{{ Str::limit($company->description ?? 'Leading company in its field.', 70) }}

View Profile →
@endforeach
@if($viewAllLink) @endif
@endif