ldc-groupe/app/View/Components/Front/Pages/KnowUs/OurImplantations.php

56 lines
1.7 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\View\Components\Front\Pages\KnowUs;
use App\Models\Company;
use App\Models\CompanyActivity;
use Illuminate\View\Component;
class OurImplantations extends Component
{
2026-02-10 15:43:47 +01:00
/** @var string $id Identification of the section. */
public string $id;
2026-02-10 15:43:47 +01:00
2026-02-12 17:14:08 +01:00
/** @var array Content section. */
public $implantations;
2026-02-10 15:43:47 +01:00
2026-02-12 17:14:08 +01:00
/** @var \Illuminate\Database\Eloquent\Collection $companyModels List of published companies. */
public $companyModels;
2026-02-10 15:43:47 +01:00
2026-02-12 17:14:08 +01:00
/** @var \Illuminate\Database\Eloquent\Collection $companyActivityModels List of published company activities. */
public $companyActivityModels;
/**
* Create a new component instance.
2026-02-10 15:43:47 +01:00
*
* @param string $id
* @param array $implantations
*/
2026-02-10 15:43:47 +01:00
public function __construct(string $id, array $implantations)
{
$this->id = $id;
$this->implantations = $implantations;
$this->companyModels = Company::getModelsCached()
->where('published', true)
->whereNotNull('sector_id')
->values();
$this->companyActivityModels = CompanyActivity::getModelsCached()
->where('published', true)
->values();
}
/**
* Get the view / contents that represent the component.
*
2026-02-10 15:43:47 +01:00
* @return \Illuminate\Contracts\View\View
*/
2026-02-10 15:43:47 +01:00
public function render(): \Illuminate\Contracts\View\View
{
return view('components.front.pages.know-us.our-implantations', [
'companyModels' => $this->companyModels,
'companyActivityModels' => $this->companyActivityModels,
2026-02-10 15:43:47 +01:00
'implantations' => $this->implantations,
]);
}
}