<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\SaleChannelsDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\SaleChannels;
use Illuminate\Http\Request;

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

    public function create()
    {
        return view('Admin.Shop.SaleChannels.create', $data ?? []);
    }

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

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

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

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

    public function edit($id)
    {
        $data = [
            'sale_channel' => SaleChannels::get($id),
        ];

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

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