/home/mip/mip/app/Modules/Client/Controllers/Products/ProductCategoryController.php
<?php

namespace QxCMS\Modules\Client\Controllers\Products;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Products\ProductCategoryRepositoryInterface as ProductCategory;

class ProductCategoryController extends Controller
{

    public function __construct(ProductCategory $productCategory)
    {
        $this->productCategory = $productCategory;
    }

    public function store(Request $request)
    {        
        return $this->productCategory->create($request->all());
    }

    public function update(Request $request)
    {
        return $this->productCategory->update($request);
    }

    public function destroy($id)
    {
        return $this->productCategory->delete($id); 
    }

    public function getproductCategoryData()
    {
        $productCategory = $this->productCategory->select(['*']);
        return Datatables::of($productCategory)
           ->addColumn('action', function($productCategory) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$productCategory->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-action="'.url('client').'/modals/category/destroy/'.$productCategory->id.'" data-id="'.$productCategory->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}