@extends('frontend.layouts.app') @section('title-suffix') {{ __('welcome.title') }} @endsection @section('main-content')

{{ __('welcome.categories-featured') }}

@php /* script to render the categories columns as rows of 7/12 - 5/12, and then 5/12 - 7/12 ... */ $counter = 1; // the counter $width1 = 'col-lg-7'; // largeur 1 $width2 = 'col-lg-5'; // largeur 2 @endphp @foreach ($categories as $key => $category) @php $class = $key % 2 === 0 ? $width1 : $width2; // the key is odd or even ? if ($counter > 1) { [$width1, $width2] = [$width2, $width1]; // if counter reach 2 exchange the values of the widths $counter = 1; // reinitialize counter to 1 } else { $counter++; // else increment counter } @endphp @if (count($category->products))

{{ $category->name }}

@if ($category->photo != '') {{ __('welcome.categories-explore') }} {{ $category->name }} @else

{{ $category->products[0]->name }}

{{ __('welcome.categories-explore') }} {{ $category->products[0]->name }} @endif
@endif @endforeach

{{ __('welcome.products') }}

@foreach ($products_chunk as $products) @endforeach
{{--
--}}

{{ __('welcome.our-offer') }}

@include('frontend.partials.featured')
@endsection