<?php

namespace App\Http\Controllers\Admin\Botanic;

use App\Datatables\Botanic\GenresDataTable;
use App\Repositories\Botanic\Families;
use App\Repositories\Botanic\Genres;
use Illuminate\Http\Request;

class GenreController extends Controller
{
    public function index(GenresDataTable $dataTable)
    {
        return $dataTable->render('Admin.Botanic.Genres.list');
    }

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

        return view('Admin.Botanic.Genres.create', $data);
    }

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

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

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

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

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