<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\DeliveryTypesDataTable;
use App\Repositories\Shop\DeliveryTypes;
use Illuminate\Http\Request;

class DeliveryTypeController extends Controller
{
    public function index(DeliveryTypesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.DeliveryTypes.list');
    }

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

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

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

    public function edit($id)
    {
        $data = [];
        $data['delivery'] = DeliveryTypes::get($id)->toArray();

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

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