app/Http/Controllers/AdminController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
      $getProductTop = DB::select('SELECT `product`.`id`, `product`.name, SUM(`bill_details`.`quantity_bill`) as SoLuongBan FROM `bill_details` INNER JOIN `product` ON `bill_details`.`id_product`= `product`.`id`GROUP BY `product`.`id` ORDER BY SoLuongBan DESC LIMIT 4');
        $soLuongUser = DB::select('select Count(id)  as `soluong` from users where role_id != ? and id != ?',[1,1]);
        $soLuongBillCustomerTK = DB::select('select Count(id_user)  as `soluong` from bill where id_user != ?',[1]);
        $soLuongBillCustomer = DB::select('select Count(id_user)  as `soluong` from bill where id_user = ?',[1]);
        $soLuongProducts = DB::select('select Count(id)  as `soluong` from product');
        $soLuongBill = DB::select('select Count(id)  as `soluong`  from bill');
        $soLuongSale = DB::select('select Count(id)  as `soluong`  from product where sale_price != ?', [0]);
        return view('indexAdmin')
            ->with('soLuongProduct', $soLuongProducts)
            ->with('soLuongBill', $soLuongBill)
            ->with('soLuongSale', $soLuongSale)
            ->with('getProductTop',$getProductTop)
            ->with('soLuongUser',$soLuongUser)
            ->with('soLuongBillCustomerTK',$soLuongBillCustomerTK)
            ->with('soLuongBillCustomer',$soLuongBillCustomer);
    }
public function index ( ) { $ getProductTop = DB :: select ( 'SELECT `product`.`id`, `product`.name, SUM(`bill_details`.`quantity_bill`) as SoLuongBan FROM `bill_details` INNER JOIN `product` ON `bill_details`.`id_product`= `product`.`id`GROUP BY `product`.`id` ORDER BY SoLuongBan DESC LIMIT 4' ) ; $ soLuongUser = DB :: select ( 'select Count(id)  as `soluong` from users where role_id != ? and id != ?' , [ 1 , 1 ] ) ; $ soLuongBillCustomerTK = DB :: select ( 'select Count(id_user)  as `soluong` from bill where id_user != ?' , [ 1 ] ) ; $ soLuongBillCustomer = DB :: select ( 'select Count(id_user)  as `soluong` from bill where id_user = ?' , [ 1 ] ) ; $ soLuongProducts = DB :: select ( 'select Count(id)  as `soluong` from product' ) ; $ soLuongBill = DB :: select ( 'select Count(id)  as `soluong`  from bill' ) ; $ soLuongSale = DB :: select ( 'select Count(id)  as `soluong`  from product where sale_price != ?' , [ 0 ] ) ; return view ( 'indexAdmin' ) -> with ( 'soLuongProduct' , $ soLuongProducts ) -> with ( 'soLuongBill' , $ soLuongBill ) -> with ( 'soLuongSale' , $ soLuongSale ) -> with ( 'getProductTop' , $ getProductTop ) -> with ( 'soLuongUser' , $ soLuongUser ) -> with ( 'soLuongBillCustomerTK' , $ soLuongBillCustomerTK ) -> with ( 'soLuongBillCustomer' , $ soLuongBillCustomer ) ; }
Display a listing of the resource.
Display a listing of the resource .
//trả về số lượng  trong bảng sản phẩm đang bán //trả về số lượng  trong bảng Bill //trả về số lượng trong bang san phẩm đang sale