64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Botanic;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Repositories\Botanic\Species;
|
|
use App\Repositories\Botanic\Genres;
|
|
use App\Datatables\Botanic\SpeciesDataTable;
|
|
|
|
class SpecieController extends Controller
|
|
{
|
|
public function index(SpeciesDataTable $dataTable)
|
|
{
|
|
return $dataTable->render('Admin.Botanic.Species.list');
|
|
}
|
|
|
|
public function getDatatable(Request $request)
|
|
{
|
|
return Species::getDatatable($request->all());
|
|
}
|
|
|
|
public function getOptions()
|
|
{
|
|
return response()->json(['0' => ''] + Species::getOptions());
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$data['genres'] = Genres::getOptions();
|
|
return view('Admin.Botanic.Species.create', $data);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$data = $request->all();
|
|
$ret = Species::store($data);
|
|
return redirect()->route('Admin.Botanic.Species.index');
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
$data = Species::get($id);
|
|
return view('Admin.Botanic.Species.view', $data);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$data['specie'] = Species::get($id);
|
|
$data['genres'] = Genres::getOptions();
|
|
return view('Admin.Botanic.Species.edit', $data);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
return Species::destroy($id);
|
|
}
|
|
|
|
public function exportExcel()
|
|
{
|
|
return Species::exportExcel();
|
|
}
|
|
}
|