<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use App\ImageUpload;
use App\User; 
use App\Category;
use App\Instagram;
use App\Client;
use App\Gallery;
use App\Post;
use Auth;
use File;
use Validator; 

class HomeController extends Controller
{

    /*********************************
     *** Show the application dashboard.
     ********************************* 
     *** @return \Illuminate\Contracts\Support\Renderable
     ********************************/
    
    public function index()
    {
    	$Categories =  Category::all();
        // To Get All Causes active
        $Causes =  Post::where('featured', '=', 'on')->simplepaginate(8);
        //To Get All  Events active 
        $Events = Client::orderBy('created_at','desc')->paginate(4);
        //To Get All Gallery active 
        $Gallers = Gallery::orderBy('created_at','desc')->paginate(20);
        return view('Pages/home',compact('Categories','Causes','Events','Gallers'));
    }

    /**
     * Show the application dashboard.
     * 
     * @return \Illuminate\Contracts\Support\Renderable
    **/

    public function about()
    {
        $Albums_Latests = Instagram::oldest()->simplepaginate(12);
        return view('Pages/about',compact('Albums_Latests'));
    } 

    /**
     * Show the application dashboard contacts_us.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */

    public function contacts_us()
    {
        return view('Pages/contacts_us');
    }

    /**
     * Show the application dashboard contacts_us.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */

     public function donate_now()
     {
         return view('Pages/donate_now');
     }

     /**
     * Show the application dashboard conditions.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */

    public function conditions()
    {
        return view('Pages/conditions');
    }

}
