<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\ContentsDataTable;
use App\Repositories\Shop\Contents;
use Illuminate\Http\Request;

class ContentController extends Controller
{
    public function index(ContentsDataTable $dataTable)
    {
        return $dataTable->render('Admin.Shop.Contents.list');
    }

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

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

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

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

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

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