<?php

namespace App\Http\Controllers\Admin\Botanic;

use App\Datatables\Botanic\FamiliesDataTable;
use App\Repositories\Botanic\Families;
use Illuminate\Http\Request;

class FamilyController extends Controller
{
    public function index(FamiliesDataTable $dataTable)
    {
        return $dataTable->render('Admin.Botanic.Families.list');
    }

    public function create()
    {
        return view('Admin.Botanic.Families.create');
    }

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

        return redirect()->route('Admin.Botanic.Families.index');
    }

    public function edit($id)
    {
        $data['family'] = Families::get($id)->toArray();

        return view('Admin.Botanic.Families.edit', $data);
    }

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