<?php

namespace App\Http\Controllers\Admin\Shop;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

use App\Repositories\Shop\Invoices;
use App\Datatables\Shop\InvoicesDataTable;

class InvoiceController extends Controller
{
    public function index(InvoicesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.Invoices.list');
    }

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

    public function store(Request $request)
    {
        $ret = Invoices::store($request->all());
        return redirect()->route('Admin.Shop.Invoices.index');
    }

    public function show($id)
    {
        $data = Invoices::get($id);
        return view('Admin.Shop.Invoices.view', $data);
    }

    public function edit($id)
    {
        $data['customer'] = Invoices::get($id)->toArray();
        return view('Admin.Shop.Invoices.edit', $data);
    }

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