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 @@
-
+
@@ -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)
+
+
+
+ @endif
+ @endforeach
+ @endif
+
+
+
+
+
+
+{{--
+
+
+
+ @if ($ads->isNotEmpty())
+ @foreach ($ads as $ad)
+ @if ($ad->ad_categories_id == )
+
+
+
+ @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 @@
-
+
@@ -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 @@
-
+
@@ -146,7 +148,8 @@
@@ -159,3 +162,21 @@
+
+
+
+
+
+ @if ($ads->isNotEmpty())
+ @foreach ($ads as $ad)
+ @if ($ad->ad_categories_id == 4)
+
+
+
+ @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)
+
+
+
+ @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)
+
+
+
+ @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)
@@ -49,7 +50,7 @@
diff --git a/resources/views/hulaki_khabar/home/main-news.blade.php b/resources/views/hulaki_khabar/home/main-news.blade.php
index 234cded..2702274 100644
--- a/resources/views/hulaki_khabar/home/main-news.blade.php
+++ b/resources/views/hulaki_khabar/home/main-news.blade.php
@@ -1,39 +1,58 @@
{{-- main-news --}}
- @if($featuredNews)
-
-
-
-
-
-
-
+ @if ($featuredNews)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{!! $featuredNews->content !!}
+
-
-
-
-
-
-
-
-
-
-
-
-
{!!$featuredNews->content!!}
-
-
-
@endif
+
+
+
+
+ @if ($ads->isNotEmpty())
+ @foreach ($ads as $ad)
+ @if ($ad->ad_categories_id == 3)
+
+
+
+ @endif
+ @endforeach
+ @endif
+
+
+
+
-
\ No newline at end of file
+
diff --git a/resources/views/hulaki_khabar/home/main-video.blade.php b/resources/views/hulaki_khabar/home/main-video.blade.php
index 762f949..05c0a88 100644
--- a/resources/views/hulaki_khabar/home/main-video.blade.php
+++ b/resources/views/hulaki_khabar/home/main-video.blade.php
@@ -113,3 +113,21 @@
+
+
+
+
+
+ @if ($ads->isNotEmpty())
+ @foreach ($ads as $ad)
+ @if ($ad->ad_categories_id == 14)
+
+
+
+ @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 @@
+
+
+
+
+
+ @if ($ads->isNotEmpty())
+ @foreach ($ads as $ad)
+ @if ($ad->ad_categories_id == 6)
+
+
+
+ @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)
+
+
+
+ @endif
+ @endforeach
+ @endif
+
+
+
+
@@ -21,8 +37,7 @@
-
+
@@ -32,16 +47,24 @@
-