<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\CustomerAddressesDataTable;
use App\Repositories\Shop\CustomerAddresses;
use Illuminate\Http\Request;

class CustomerAddressController extends Controller
{
    public function index(CustomerAddressesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.CustomerAddresses.list');
    }

    public function create()
    {
        $data = [
            'with_country' => false,
        ];

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

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

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

    public function show($id)
    {
        $data = [
            'customer' => CustomerAddresses::get($id),
        ];

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

    public function edit($id)
    {
        $data = [
            'customer' => CustomerAddresses::edit($id),
        ];

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

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