This commit is contained in:
tanch0
2024-06-23 17:02:56 +05:45
parent 25760ad989
commit f85671cd4c
93 changed files with 2886 additions and 1579 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Mail\sendEmail;
use App\Models\Advertisements;
use App\Models\Articles;
use App\Models\Comments;
use App\Models\Economies;
use App\Models\Horoscopes;
use App\Models\Menuitems;
@ -18,6 +19,7 @@ use App\Models\Teams;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Route;
use App\Models\Videos;
use Share;
@ -27,6 +29,13 @@ class WebsiteController extends Controller
public function __construct()
{
$routes = Route::getRoutes();
// dd($routes);
// foreach ($routes as $route) {
// $name= $route->getName();
// dump($name);
// }
// dd('end');
$this->path = config('app.client_path');
$headerMenuItems = Menuitems::where(['parent_menu' => 0, "status" => 1, "menulocations_id" => 1])->with('children')->orderBy('display_order')->get();
@ -36,6 +45,8 @@ class WebsiteController extends Controller
$ads = Advertisements::where('status', 1)->where('parent_advertisement', 0)->get();
$adsWithChildren = Advertisements::where('status', 1)->where('parent_advertisement', 0)->orderBy('display_order')->with('children')->get();
$popup = Popups::where('status',1)->latest()->first();
$route = Route::getRoutes();
View::share(
[
'headerMenuItems' => $headerMenuItems,
@ -104,7 +115,8 @@ class WebsiteController extends Controller
$news->views_count = $news->views_count + 1;
$news->save();
$newsWithComment = News::with('comments')->where('news_id', $news->news_id)->get();
// dd($newsWithComment->toArray());
$recentNews = News::where('status', 1)
->where('news_id', '!=', $news->news_id)
->inRandomOrder()
@ -112,7 +124,7 @@ class WebsiteController extends Controller
->latest()
->get();
return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent'));
return view($this->path . '.news-detail', compact('news', 'recentNews','shareComponent','newsWithComment'));
}