<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\DeliveryPackagesDataTable;
use App\Repositories\Shop\DeliveryPackages;
use Illuminate\Http\Request;

class DeliveryPackageController extends Controller
{
    public function index(DeliveryPackagesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.DeliveryPackages.list');
    }

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

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

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

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

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

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