<?php

namespace App\Http\Controllers\Lamis;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Abouts;
use App\Slider;
use App\Mail;
use App\Http\Requests\SubscribeRequest;
use App\Http\Requests\ContactRequest;
use App\Gallery;
use App\Partner;
use App\Contact;

class HomeController extends Controller
{
       public function subscribe(SubscribeRequest $request){
        Mail::create($request->all());
        return redirect()->back();
    }
    
  
public function privacy(){
         
        $partners = Partner::cursor();
         return view('lamis.privacy',compact('partners'));

     }
     
     public function conditions(){
         
$partners = Partner::cursor();
         return view('lamis.conditions',compact('partners'));

     }
     public function contacts(){
         

         return view('lamis.contacts');

     }
     public function contactus(ContactRequest $request){
         Contact::create($request->all());
          return redirect()->back()->with('success','تم تسجيل طلبك بنجاح');
    }
    
    public function index($value='')
    {
        
        $sliders = Slider::cursor();
        $galleries = Gallery::cursor();
        $partners = Partner::cursor();
        $about = Abouts::first();
    	return view('lamis.index',compact('sliders','galleries','partners','about'));
    }
    public function about($value='')
    {
        $count = Abouts::count();
        $main = Abouts::first();
        $skip = 1;
        $limit = $count - $skip;
        $abouts = Abouts::skip($skip)->take($limit)->get();
        
    	return view('lamis.aboutus',['main'=>$main,'abouts'=>$abouts]);
    }
    public function levels(){
        return view('lamis.infographic');
    }
}
