<?php

namespace App\Http\Controllers\frontend;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

use App\Models\Slider;
use App\Models\Content;
use App\Models\Planning;
use App\Models\Product;
use App\Models\Testimonial;
use App\Models\About;
use App\Models\WebInfo;
use App\Models\Seo;
use App\Models\Team;
use App\Models\Certificate;

class FrontendController extends Controller
{
    public function index(){
        $data['sliders']=Slider::where(['stutas'=>1])->get();
        $data['plannings']=Planning::all();
        $data['testimonials']=Testimonial::all();
        
        $data['content1']=Content::where(['id'=>1])->get();
        $data['content2']=Content::where(['id'=>2])->get();
        $data['content3']=Content::where(['id'=>3])->get();
        $data['content4']=Content::where(['id'=>4])->get();
        $data['content5']=Content::where(['id'=>5])->get();
        $data['content6']=Content::where(['id'=>6])->get();
        $data['content7']=Content::where(['id'=>7])->get();
        $data['content8']=Content::where(['id'=>8])->get();
        $data['content9']=Content::where(['id'=>9])->get();
        $data['content10']=Content::where(['id'=>10])->get();
        // $data['content11']=Content::where(['id'=>11])->get();
        // $data['content12']=Content::where(['id'=>12])->get();
        // $data['content13']=Content::where(['id'=>13])->get();
        // $data['content14']=Content::where(['id'=>14])->get();
        // $data['content15']=Content::where(['id'=>15])->get();
        // $data['content16']=Content::where(['id'=>16])->get();

        // $i = 1;
        // while (Content::all()) {
        //     $data['content"$i"']=Content::where(['id'=>$i])->get();
        //     $i++;
        // }

        return view('frontend/index', $data);
    }

    public function services(){
        $data['plannings'] = Planning::all();

        return view('frontend/services', $data);
    }
    public function products(){
        $data['products'] = Product::all();

        return view('frontend/products', $data);
    }

    public function teams(){
        $data['management_teams'] = Team::where('type', 'management')->get();
        $data['operational_teams'] = Team::where('type', 'operational')->get();

        return view('frontend/team', $data);
    }

    public function certificates(){
        $data['certificates'] = Certificate::all();

        return view('frontend/certificate', $data);
    }

    public function contact(){
        $data['plannings'] = Planning::all();
        $data['webinfo'] = WebInfo::all();

        return view('frontend/contact', $data);
    }

    public function about(){
        $data['abouts'] = About::all();
        $data['plannings'] = Planning::all();
        $data['products'] = Product::all();

        return view('frontend/about', $data);
    }

}
