<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\PriceGenericCategoriesDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\ArticleNatures;
use App\Repositories\Shop\PriceGenericCategories;
use Illuminate\Http\Request;

class PriceGenericCategoryController extends Controller
{
    public function index(PriceGenericCategoriesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.PriceGenericCategories.list');
    }

    public function create()
    {
        $data['families'] = ArticleNatures::getOptions();

        return view('Admin.Shop.PriceGenericCategories.create', $data);
    }

    public function edit($id)
    {
        $data['families'] = ArticleNatures::getOptions();
        $data['generic_category'] = PriceGenericCategories::get($id)->toArray();

        return view('Admin.Shop.PriceGenericCategories.edit', $data);
    }

    public function store(Request $request)
    {
        $ret = PriceGenericCategories::store($request->all());

        return redirect()->route('Admin.Shop.PriceGenericCategories.index');
    }

    public function show($id)
    {
        $data = PriceGenericCategories::get($id);

        return view('Admin.Shop.PriceGenericCategories.view', $data);
    }

    public function destroy($id)
    {
        return PriceGenericCategories::destroy($id);
    }
}
