From 9bb573169d29ed108926cc25c95e87570a98f13a Mon Sep 17 00:00:00 2001 From: tanch0 Date: Wed, 19 Jun 2024 00:25:14 +0545 Subject: [PATCH] content --- app/Http/Controllers/WebsiteController.php | 14 +++- app/Models/Advertisements.php | 77 ++++++++++-------- resources/views/hulaki_khabar/home.blade.php | 14 ++-- .../hulaki_khabar/home/business.blade.php | 76 ++++++++++++++---- .../hulaki_khabar/home/country.blade.php | 33 ++++++-- .../hulaki_khabar/home/culture-tech.blade.php | 45 +++++++++-- .../hulaki_khabar/home/feature.blade.php | 42 ++++++++-- .../views/hulaki_khabar/home/health.blade.php | 29 +++++-- .../home/international.blade.php | 35 ++++---- .../hulaki_khabar/home/main-news.blade.php | 79 ++++++++++++------- .../hulaki_khabar/home/main-video.blade.php | 18 +++++ .../hulaki_khabar/home/politics.blade.php | 57 +++++++++---- .../views/hulaki_khabar/news-detail.blade.php | 56 +++++++++---- .../hulaki_khabar/partials/footer.blade.php | 2 +- .../hulaki_khabar/partials/header.blade.php | 25 ++++-- 15 files changed, 431 insertions(+), 171 deletions(-) diff --git a/app/Http/Controllers/WebsiteController.php b/app/Http/Controllers/WebsiteController.php index d129581..260e61c 100644 --- a/app/Http/Controllers/WebsiteController.php +++ b/app/Http/Controllers/WebsiteController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Mail\sendEmail; +use App\Models\Advertisements; use App\Models\Articles; use App\Models\Economies; use App\Models\Horoscopes; @@ -29,13 +30,20 @@ class WebsiteController extends Controller $headerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 1])->with('children')->orderBy('display_order')->get(); // dd($headerMenuItems->toArray()); $footerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 2])->with('children')->orderBy('display_order')->get(); - // dd($footerMenuItems->toArray()); - $recentNews = News::where('status', 1)->inRandomOrder()->limit(4)->get(); + $latestNews = News::where('status', 1)->inRandomOrder()->limit(4)->get(); + // dd($recentNews); + + $ads = Advertisements::where('status', 1)->where('parent_advertisement',0)->get(); + // dd($ads->toArray()); + $adsWithChildren = Advertisements::where('status',1)->where('parent_advertisement',0)->orderBy('display_order')->with('children')->get(); + // dd($adsWithChildren->toArray()); View::share( [ 'headerMenuItems' => $headerMenuItems, 'footerMenuItems' => $footerMenuItems, - 'recentNews' => $recentNews, + 'latestNews' => $latestNews, + 'ads' => $ads, + 'adsWithChildren' => $adsWithChildren ] ); } diff --git a/app/Models/Advertisements.php b/app/Models/Advertisements.php index c8b741e..381b17d 100644 --- a/app/Models/Advertisements.php +++ b/app/Models/Advertisements.php @@ -1,41 +1,42 @@ status == 1 ? ' Active ' : 'Inactive'; - } + ]; + + protected $appends = ['status_name']; + + protected function getStatusNameAttribute() + { + return $this->status == 1 ? ' Active ' : 'Inactive'; + } protected function createdBy(): Attribute { @@ -50,4 +51,14 @@ get: fn ($value) => User::find($value) ? User::find($value)->name : '', ); } - } \ No newline at end of file + + public function children() + { + return $this->hasMany(Advertisements::class, 'parent_advertisement'); + } + + public function parent() + { + return $this->belongsTo(Advertisements::class, 'parent_advertisement'); + } +} diff --git a/resources/views/hulaki_khabar/home.blade.php b/resources/views/hulaki_khabar/home.blade.php index eb2ad5d..26d017b 100644 --- a/resources/views/hulaki_khabar/home.blade.php +++ b/resources/views/hulaki_khabar/home.blade.php @@ -1,23 +1,23 @@ @extends('hulaki_khabar.layout.layout') @section('content') @include('hulaki_khabar.home.main-news') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.country') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.international') @include('hulaki_khabar.home.politics') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.interview') @include('hulaki_khabar.home.business') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.sports') @include('hulaki_khabar.home.culture-tech') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.entertainment') @include('hulaki_khabar.home.feature') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.main-video') - @include('hulaki_khabar.home.ads') + {{-- @include('hulaki_khabar.home.ads') --}} @include('hulaki_khabar.home.society') @include('hulaki_khabar.home.health') @endsection \ No newline at end of file diff --git a/resources/views/hulaki_khabar/home/business.blade.php b/resources/views/hulaki_khabar/home/business.blade.php index 8004930..e1af012 100644 --- a/resources/views/hulaki_khabar/home/business.blade.php +++ b/resources/views/hulaki_khabar/home/business.blade.php @@ -42,13 +42,14 @@ @foreach ($type->news->take(5) as $item)
@@ -62,7 +63,8 @@
- + image @@ -72,7 +74,7 @@

{{ $item->title }} + href="{{ route('newsDetail', ['alilas' => $item->alias]) }}">{{ $item->title }}

@@ -91,20 +93,64 @@
- +
+
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 8) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
+ + +{{--
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == ) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
--}} diff --git a/resources/views/hulaki_khabar/home/country.blade.php b/resources/views/hulaki_khabar/home/country.blade.php index c0eea6e..0c04674 100644 --- a/resources/views/hulaki_khabar/home/country.blade.php +++ b/resources/views/hulaki_khabar/home/country.blade.php @@ -75,7 +75,8 @@
- + image @@ -86,7 +87,7 @@

{{ $item->short_description }} + href="{{ route('newsDetail', ['alias' => $item->alias]) }}">{{ $item->short_description }}

@@ -115,12 +116,13 @@ @foreach ($type->news->take(1) as $item) @if ($loop->first) @@ -137,7 +139,7 @@
- + image
@@ -146,7 +148,8 @@ @@ -159,3 +162,21 @@
+ +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 4) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
diff --git a/resources/views/hulaki_khabar/home/culture-tech.blade.php b/resources/views/hulaki_khabar/home/culture-tech.blade.php index 955f248..bb86cac 100644 --- a/resources/views/hulaki_khabar/home/culture-tech.blade.php +++ b/resources/views/hulaki_khabar/home/culture-tech.blade.php @@ -143,16 +143,49 @@
+
+ +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 10) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
+ + diff --git a/resources/views/hulaki_khabar/home/feature.blade.php b/resources/views/hulaki_khabar/home/feature.blade.php index c6c9410..8699f56 100644 --- a/resources/views/hulaki_khabar/home/feature.blade.php +++ b/resources/views/hulaki_khabar/home/feature.blade.php @@ -43,14 +43,44 @@

+ +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 12) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
diff --git a/resources/views/hulaki_khabar/home/health.blade.php b/resources/views/hulaki_khabar/home/health.blade.php index db32d8b..47f3d2e 100644 --- a/resources/views/hulaki_khabar/home/health.blade.php +++ b/resources/views/hulaki_khabar/home/health.blade.php @@ -20,14 +20,15 @@ @foreach ($type->news as $item)
@@ -40,12 +41,24 @@
diff --git a/resources/views/hulaki_khabar/home/international.blade.php b/resources/views/hulaki_khabar/home/international.blade.php index 0c8b5be..7989551 100644 --- a/resources/views/hulaki_khabar/home/international.blade.php +++ b/resources/views/hulaki_khabar/home/international.blade.php @@ -24,13 +24,14 @@ @foreach ($type->news->take(1) as $item) + +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 14) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
diff --git a/resources/views/hulaki_khabar/home/politics.blade.php b/resources/views/hulaki_khabar/home/politics.blade.php index 85c3a7e..f2e9837 100644 --- a/resources/views/hulaki_khabar/home/politics.blade.php +++ b/resources/views/hulaki_khabar/home/politics.blade.php @@ -15,21 +15,21 @@
- {{-- @dd($politics) --}} @foreach ($politics as $type) - @if ($type->alias ==='politics') + @if ($type->alias === 'politics') @foreach ($type->news->take(1) as $item) @if ($loop->first) @@ -48,7 +48,7 @@
@@ -57,7 +57,7 @@

{{ $item->short_description }} + href="{{ route('newsDetail', ['alias' => $item->alias]) }}">{{ $item->short_description }}

@@ -74,19 +74,44 @@
+ +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 6) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
diff --git a/resources/views/hulaki_khabar/news-detail.blade.php b/resources/views/hulaki_khabar/news-detail.blade.php index 627f6c8..6669844 100644 --- a/resources/views/hulaki_khabar/news-detail.blade.php +++ b/resources/views/hulaki_khabar/news-detail.blade.php @@ -1,6 +1,22 @@ @extends('hulaki_khabar.layout.layout') @section('content') - +
+
+
+
+ @if ($ads->isNotEmpty()) + @foreach ($ads as $ad) + @if ($ad->ad_categories_id == 17) + + {{ $ad->title }} + + @endif + @endforeach + @endif +
+
+
+
@@ -21,8 +37,7 @@
- image + image
@@ -32,16 +47,24 @@
- +