master_template/app/Http/Controllers/WebsiteController.php
2024-06-16 00:15:09 +05:45

59 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Economies;
use App\Models\News;
use App\Models\News_type;
use App\Models\Newscategories;
use App\Models\Provinces;
class WebsiteController extends Controller
{
private $path;
public function __construct()
{
$this->path = config('app.client_path');
}
public function home(){
$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();
$data['sports'] = Newscategories::with('sportNews')->get();
$data['cultural'] = Newscategories::with('culturalNews')->get();
$data['technology'] = Newscategories::with('technologyNews')->get();
$data['entertainment'] = Newscategories::with('entertainmentNews')->get();
$data['branches'] = Newscategories::with('branchesNews')->get();
// dd($data['entertainment']);
$data['internationalNews'] = News_type::with('news')->get();
// dd($data['internationalNews']);
return view($this->path.'.home',$data);
}
public function single(){
return view($this->path.'.single');
}
public function newsDetail(){
return view($this->path.'.news-detail');
}
}