File: /var/www/html/sarvodayahospital/app/Http/Controllers/HomeController.php
<?php
namespace App\Http\Controllers;
use App\Models\Award;
use App\Models\Blog;
use App\Models\Doctor;
use App\Models\DoctorVideo;
use App\Models\Hospital;
use App\Models\News;
use App\Models\Organ;
use App\Models\PreventiveHealthCheckup;
use App\Models\RareCase;
use App\Models\Speciality;
use App\Models\Technology;
use App\Models\Testimonial;
use Artesaos\SEOTools\Facades\OpenGraph;
use Artesaos\SEOTools\Facades\SEOMeta;
use Illuminate\Support\Facades\Cache;
class HomeController extends Controller
{
public function index()
{
$hospitals = Cache::remember('all-hospitals', 60, function () {
return Hospital::query()
->orderBy('Weight', 'asc')
->get();
});
$filteredHospitals = $hospitals->whereNotIn('Slug', ['sarvodaya-imaging-centre-with-nrch', 'sarvodaya-imaging-centre-with-ndmc'])->all();
$specialities = Cache::remember('all_specialities', 60, function () {
return Speciality::query()
->where('IsCentreOfExcellence', true)
->orderBy('Weight', 'asc')
->get()
->take(12);
});
$organs = Cache::remember('all_organs', 60, function () {
return Organ::query()
->with('speciality')
->get();
});
$doctorSpecialityTabs = Speciality::query()
->whereHas(
'doctors',
function ($q) {
$q->orderBy('Weight', 'asc')->limit(4);
}
)
->where('showAtHome', true)
->orderBy('Weight', 'asc')
->get()
->take(6);
$doctors = Doctor::query()
->orderByRaw('ISNULL(Weight), Weight ASC')
->orderBy('Weight', 'asc')
->get()
->take(4);
$technologies = Technology::query()
->select('id', 'Title', 'Description', 'Slug', 'DisplayName')
->orderByWeight()
->get()
->take(5);
$awards = Award::query()
->orderby('Date', 'DESC')
->get()
->take(6);
$rarecases = RareCase::query()
->orderBy('created_at', 'DESC')
->get()
->take(10);
$news = News::query()
->orderBy('PublicationDate', 'DESC')
->get()
->take(6);
$phc = PreventiveHealthCheckup::query()
->select('id', 'PackageName', 'Slug')
->get()
->take(6);
$testimonials = Testimonial::query()
->orderBy('Date', 'DESC')
->get()
->take(4);
$doctorvideos = DoctorVideo::query()
->orderBy('Date', 'DESC')
->get()
->take(4);
$blogs = Blog::query()
->orderBy('BlogCreatedDate', 'DESC')
->get()
->take(10);
SEOMeta::setTitle('Best Hospital in Faridabad Delhi NCR, India | Sarvodaya Hospital', false)
->setDescription('Sarvodaya Hospital is one of the Top and Best multi-specialty hospital in Faridabad Delhi NCR, India with provide the world class healthcare services in India.')
->setKeywords('Best Hospitals In India, Top Hospitals In India, Hospital In Faridabad, Best Hospital In Delhi, Hospitals In India, Best Hospitals In Faridabad, Top Hospitals In Greater Noida');
OpenGraph::setTitle('Best Hospital in Faridabad Delhi NCR, India | Sarvodaya Hospital')
->setDescription('Sarvodaya Hospital is one of the Top and Best multi-specialty hospital in Faridabad Delhi NCR, India with provide the world class healthcare services in India.');
return view(
'pages.home',
compact(
'hospitals',
'filteredHospitals',
'specialities',
'doctorSpecialityTabs',
'doctors',
'technologies',
'awards',
'rarecases',
'news',
'phc',
'testimonials',
'doctorvideos',
'blogs',
'organs'
)
);
}
}