<?php
namespace QxCMS\Modules\Client\Controllers\Products;
use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;
use QxCMS\Modules\Client\Repositories\Products\ProductBrandRepositoryInterface as ProductBrand;
class ProductBrandController extends Controller
{
public function __construct(ProductBrand $productBrand)
{
$this->productBrand = $productBrand;
}
public function store(Request $request)
{
return $this->productBrand->create($request->all());
}
public function update(Request $request)
{
return $this->productBrand->update($request);
}
public function destroy($id)
{
return $this->productBrand->delete($id);
}
public function getproductBrandData()
{
$productBrand = $this->productBrand->select(['*']);
return Datatables::of($productBrand)
->addColumn('action', function($productBrand) {
$html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$productBrand->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/brand/destroy/'.$productBrand->id.'" data-id="'.$productBrand->id.'">
<i class="fa fa-trash-o"></i>
</a>';
return $html;
})->make(true);
}
}