<commit_before><?php

namespace App\Http\Controllers;

use Request;
use Cart;

class ProductController extends Controller
{
    public function productDetail($shopProductId)
    {
        $shopProduct = \App\ShopProduct::find($shopProductId);
        $attributes = $shopProduct->product->productAttributeValues;
        return view('productDetail')
            ->with('shopProduct', $shopProduct)
            ->with('attributes', $attributes);
    }

    public function muaHang($id){
        if (Request::ajax()){
            $product_buy=\App\ShopProduct::where('id', $id)->first();
            $attributes = $product_buy->product->productAttributeValues;
            Cart::add(['id' =>$product_buy->product->id, 'name' =>$product_buy->product->name, 'qty' => 1, 'price' =>
            $product_buy->product->price]);
            $content=Cart::content();
        };
    }

    public function gioHang()
    {
        $content=Cart::content();
        $total=Cart::total();
        return view('shopping_cart')->with('content', $content)->with('total', $total);
    }

    public function xoaGioHang($rowId)
    {
        Cart::remove($rowId);
        return redirect('gio-hang')->withSuccess('Cat has been updated.');
    }

    public function editGioHang(){
        if (Request::ajax())
        {
            $id=Request::get('id') ;
            $qty=Request::get('qty') ;
            Cart::update($id, $qty);
        }
    }<commit_msg>shopping cart<commit_after><?php

namespace App\Http\Controllers;

use Request;
use Cart;

class ProductController extends Controller
{
    public function productDetail($shopProductId)
    {
        $shopProduct = \App\ShopProduct::find($shopProductId);
        $attributes = $shopProduct->product->productAttributeValues;
        return view('productDetail')
            ->with('shopProduct', $shopProduct)
            ->with('attributes', $attributes);
    }

    public function muaHang($id)
    {
        if (Request::ajax() ) {
            $product_buy=\App\ShopProduct::where('id', $id)->first();
            $attributes = $product_buy->product->productAttributeValues;
            Cart::add(['id' =>$product_buy->product->id, 'name' =>$product_buy->product->name, 'qty' => 1, 'price' =>
            $product_buy->product->price]);
            $content=Cart::content();
        };
    }

    public function gioHang()
    {
        $content=Cart::content();
        $total=Cart::total();
        return view('shopping_cart')->with('content', $content)->with('total', $total);
    }

    public function xoaGioHang($rowId)
    {
        Cart::remove($rowId);
        return redirect('gio-hang')->withSuccess('Cat has been updated.');
    }

    public function editGioHang()
    {
        if (Request::ajax()) {
            $id=Request::get('id') ;
            $qty=Request::get('qty') ;
            Cart::update($id, $qty);
        }
    }
{'fraction_non_alphanumeric': 0.1682825484764543, 'fraction_numerical': 0.0006925207756232687, 'mean_word_length': 2.638539042821159, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1072208', 'n_tokens_mistral': 848, 'n_tokens_neox': 827, 'n_words': 139}