<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\TariffUnitiesDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\TariffUnities;
use Illuminate\Http\Request;

class TariffUnityController extends Controller
{
    public function index(TariffUnitiesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.TariffUnities.list', $data ?? []);
    }

    public function create()
    {
        return view('Admin.Shop.TariffUnities.create');
    }

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

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

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

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

    public function edit($id)
    {
        $data = [
            'tariff_unity' => TariffUnities::getArray($id),
        ];

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

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