Add new version in repository
This commit is contained in:
77
app/Http/Controllers/Admin/Botanic/VarietyController.php
Normal file
77
app/Http/Controllers/Admin/Botanic/VarietyController.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Botanic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Shop\TagGroups;
|
||||
use App\Datatables\Botanic\VarietiesDataTable;
|
||||
|
||||
use App\Models\Shop\Variety;
|
||||
|
||||
class VarietyController extends Controller
|
||||
{
|
||||
public function index(VarietiesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Botanic.Varieties.list');
|
||||
}
|
||||
|
||||
public function getOptionsWithSpecie()
|
||||
{
|
||||
return response()->json(Varieties::getOptionsWithSpecie());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data['species'] = Species::getOptions();
|
||||
$data['tags_list'] = TagGroups::getTreeTags();
|
||||
return view('Admin.Botanic.Varieties.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Varieties::storeFull($data);
|
||||
return redirect()->route('Admin.Botanic.Varieties.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return view('Admin.Botanic.Varieties.view', Varieties::get($id));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Varieties::getFull($id);
|
||||
$data['species'] = Species::getOptions();
|
||||
$data['tags_list'] = TagGroups::getTreeTags();
|
||||
return view('Admin.Botanic.Varieties.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Varieties::destroy($id);
|
||||
}
|
||||
|
||||
public function getImages(Request $request, $id = false, $can_edit = true)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data['images'] = Varieties::getImages($id);
|
||||
$data['can_edit'] = $can_edit;
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
public function deleteImage(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
return Varieties::deleteImage($id, $index);
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
{
|
||||
return Varieties::exportExcel();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user