From 2a7870bed35f30735467ae9c4c77a35491a5a97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=20=D0=9B=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Wed, 20 Mar 2024 20:19:51 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0?= =?UTF-8?q?=B8=D0=B5=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=81=D1?= =?UTF-8?q?=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/MainController.php | 4 +++- resources/views/index.blade.php | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 8b2cd33..c796fdc 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -9,6 +9,7 @@ use App\Models\Ad_employer; use App\Models\Category; use App\Models\Education; use App\Models\Employer; +use App\Models\employers_main; use App\Models\Job_title; use App\Models\News; use App\Models\reclame; @@ -32,7 +33,8 @@ class MainController extends Controller ->GroupBy('categories.id') ->get(); - $employers = Employer::query()->orderBy('id')->limit(20)->get(); + $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); + return view('index', compact('news', 'categories', 'employers')); } diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index c35aefe..fdbb4cd 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -102,20 +102,22 @@ @php $rec = 0; $count = $employers->count(); + @endphp + @foreach($employers as $emp) @php $rec++ @endphp @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17))
@endif - @if (!empty($emp->logo)) - - {{ $emp->name_company }} + @if (!empty($emp->employer->logo)) + + {{ $emp->employer->name_company }} @else - - {{ $emp->name_company }} + + {{ $emp->employer->name_company }} @endif @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) -- 1.7.10.4