<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use DB;
use Session;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public static function cartCount(){
        $session_id = Session::get('session_id');
        $count = DB::table('cart')->where(['session_id'=>$session_id])->count();

        return $count;
    }

    public static function subTotal(){
        $session_id = Session::get('session_id');
        $subtotal = DB::table('cart')->where(['session_id'=>$session_id])->sum('total');

        return $subtotal; 
    }

    public static function cartPro(){
        $session_id = Session::get('session_id');
        $cartpro = DB::table('cart')->where(['session_id'=>$session_id])->get();

        return $cartpro;
    }
}
