File: /home/jubaroyal/public_html/app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use App\Models\Faq;
use App\Models\Blog;
use App\Models\Page;
use App\Models\Team;
use App\Models\Slide;
use App\Models\Client;
use App\Models\Counter;
use App\Models\Country;
use App\Models\Project;
use App\Models\Service;
use App\Models\Setting;
use App\Models\Testimonial;
use App\Models\Differentiation;
use App\Models\Purpose;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
Paginator::useBootstrap();
$showSettings = Setting::where('id', '=', 1)->first();
$showPages = Page::where('id', '=', 1)->first();
$showProjects = Project::with(['projectType'])->where('status', '=', 'Active')->orderBy('id', 'desc')->paginate(12);
// $showAllProjects = Project::with(['projectType'])->where('status', '=', 'Active')->orderBy('id', 'desc')->paginate(2);
$showBlogs = Blog::with(['createdBy', 'blogCategory'])->where('status', '=', 'Published')->orderBy('id', 'desc')->paginate(12);
$showBlogPhotos = Blog::with(['blogCategory'])->where('status', '=', 'Published')->orderBy('id', 'desc')->limit(9)->get();
$showRecentBlogs = Blog::with(['blogCategory'])->where('status', '=', 'Published')->orderBy('id', 'desc')->limit(3)->get();
$showFunFacts = Counter::where('status', '=', 'Active')->get();
$showClients = Client::where('status', '=', 'Active')->whereNotNull('logo')->get();
$showDifferentiations = Differentiation::where('status', '=', 'Active')->get();
// $showTestimonials = Testimonial::get();
$showCountries = Country::where('status', '=', 'Active')->orderBy('name', 'asc')->get();
$showPurposes = Purpose::where('status', '=', 'Active')->orderBy('name', 'asc')->get();
$showTestimonials = Testimonial::where('status', '=', 'Active')->orderBy('id', 'desc')->get();
$showTeams = Team::where('status', '=', 'Published')->orderBy('id', 'asc')->paginate(12);
$showFaqs = Faq::where('status', '=', 'Published')->orderBy('id', 'DESC')->limit(8)->get();
$showServices = Service::where('status', '=', 'Active')->orderBy('id', 'asc')->paginate(12);
$showSelectServices = Service::whereIn('id', [1, 2, 3])->where('status', '=', 'Active')->orderBy('id', 'asc')->get();
$showOtherServices = Service::whereNotIn('id', [1, 2, 3])->where('status', '=', 'Active')->orderBy('id', 'asc')->get();
$showSlides = Slide::where('status', '=', 'Published')->orderBy('id', 'asc')->get();
view()->share('globalSettings', $showSettings);
view()->share('globalPageData', $showPages);
view()->share('globalProjects', $showProjects);
// view()->share('globalAllProjects', $showAllProjects);
view()->share('globalBlogs', $showBlogs);
view()->share('globalBlogPhotos', $showBlogPhotos);
view()->share('globalRecentBlogs', $showRecentBlogs);
view()->share('globalFunFacts', $showFunFacts);
view()->share('globalClients', $showClients);
view()->share('globalDifferentiations', $showDifferentiations);
view()->share('globalCountries', $showCountries);
view()->share('globalPurposes', $showPurposes);
view()->share('globalTestimonials', $showTestimonials);
view()->share('globalTeams', $showTeams);
view()->share('globalFaqs', $showFaqs);
view()->share('globalServices', $showServices);
view()->share('globalSelectServices', $showSelectServices);
view()->share('globalOtherServices', $showOtherServices);
view()->share('globalSlides', $showSlides);
}
}