master_template/app/Http/Controllers/WebsiteController.php

59 lines
1.7 KiB
PHP
Raw Normal View History

2024-06-10 12:21:58 +00:00
<?php
namespace App\Http\Controllers;
2024-06-15 16:38:54 +00:00
use App\Models\Economies;
use App\Models\News;
use App\Models\News_type;
use App\Models\Newscategories;
use App\Models\Provinces;
2024-06-10 12:21:58 +00:00
class WebsiteController extends Controller
{
private $path;
public function __construct()
{
$this->path = config('app.client_path');
}
public function home(){
2024-06-15 16:38:54 +00:00
$data['featuredNews'] = News::where('featured_news',"True")->where('status',1)->first();
$data['provinces'] = Provinces::with('provinceNews')->limit(5)->get();
$data['categories'] = Newscategories::with('news')->get();
$data['interviews'] = Newscategories::with('interviewNews')->get();
$data['politics'] = Newscategories::with('politicNews')->get();
// $data['economics'] = Newscategories::with('news')->inRandomOrder()->get();
$data['economics'] = Economies::with('news')
->orderBy('display_order')
->where('status',1)
->get();
2024-06-15 18:30:09 +00:00
2024-06-15 16:38:54 +00:00
$data['sports'] = Newscategories::with('sportNews')->get();
$data['cultural'] = Newscategories::with('culturalNews')->get();
$data['technology'] = Newscategories::with('technologyNews')->get();
$data['entertainment'] = Newscategories::with('entertainmentNews')->get();
2024-06-15 18:30:09 +00:00
$data['branches'] = Newscategories::with('branchesNews')->get();
2024-06-15 16:38:54 +00:00
// dd($data['entertainment']);
$data['internationalNews'] = News_type::with('news')->get();
// dd($data['internationalNews']);
return view($this->path.'.home',$data);
2024-06-13 15:17:05 +00:00
}
public function single(){
return view($this->path.'.single');
2024-06-10 12:21:58 +00:00
}
2024-06-15 16:38:54 +00:00
public function newsDetail(){
return view($this->path.'.news-detail');
}
2024-06-10 12:21:58 +00:00
}