<?php

namespace App\Http\Controllers\Admin\Shop;

use App\Datatables\Admin\Shop\PackagesDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Packages;
use Illuminate\Http\Request;

class PackageController extends Controller
{
    public function index(PackagesDataTable $dataTable)
    {
        $data = Packages::init();

        return $dataTable->render('Admin.Shop.Packages.list', $data);
    }

    public function create()
    {
        $data = Packages::init();

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

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

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

    public function show($id)
    {
        $data = Packages::get($id);

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

    public function edit($id)
    {
        $data = Packages::init();
        $data['package'] = Packages::get($id);

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

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