Merge branch 'develop' into trunk

This commit is contained in:
Noah Lancien 2026-05-12 16:23:02 +02:00
commit 8e968a6347
4 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Company;
class CompanyController
{
/**
* Retrieve all published companies with their associated activity and sector.
*
* @return \Illuminate\Http\JsonResponse
*/
public function getCompanies(): \Illuminate\Http\JsonResponse
{
$companies = Company::query()->where('published', true)->with('companyActivity', 'companySector')->get();
$data = $companies->map(function ($company) {
return array_filter([
'name' => $company->name,
'logo' => $company->logo,
'informations' => $company->informations,
'responsable' => $company->responsable,
'employees' => $company->employees,
'url' => $company->url,
'latitude' => $company->latitude,
'longitude' => $company->longitude,
'type_activite' => $company->companyActivity->name,
'filiere' => $company->companySector?->name,
], fn($value) => !is_null($value));
});
return response()->json($data);
}
}

View file

@ -14,6 +14,7 @@ return Application::configure(basePath: dirname(__DIR__))
__DIR__ . '/../routes/web-front.php',
__DIR__ . '/../routes/web-back.php',
],
api: __DIR__.'/../routes/api.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {

View file

@ -60,7 +60,7 @@
@endif
@if (isset($pageFinance))
<li id="menu-item-199" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-199">
<a href="{{ \App\Helpers\RouteHelper::routeNameChecker('front.finance') }}">{{ $pageFinance->title }}</a>
<a href="{{ \App\Helpers\RouteHelper::routeNameChecker('front.dynamic-pages.finance') }}">{{ $pageFinance->title }}</a>
</li>
@endif
@if (isset($pageNosMetiers))
@ -69,7 +69,7 @@
</li>
@endif
<li id="menu-item-6108" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-6108">
<a href="{{ LaravelLocalization::getLocalizedURL(app()->getLocale(), __('routes.contact_index')) }}">
<a href="{{ \App\Helpers\RouteHelper::routeNameChecker('front.dynamic-pages.nous-contacter') }}">
{{ ucfirst(__('front.contact.index')) }}
</a>
</li>

6
routes/api.php Normal file
View file

@ -0,0 +1,6 @@
<?php
use App\Http\Controllers\Api\CompanyController;
use Illuminate\Support\Facades\Route;
Route::get('/companies', [CompanyController::class, 'getCompanies']);