84 lines
1.8 KiB
PHP
84 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\Admin\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Modules\Admin\Repositories\DropdownInterface;
|
|
use Modules\Admin\Repositories\FieldInterface;
|
|
|
|
class FieldController extends Controller
|
|
{
|
|
private $fieldRepository;
|
|
private $dropdownRepository;
|
|
|
|
public function __construct(FieldInterface $fieldRepository,
|
|
DropdownInterface $dropdownRepository) {
|
|
$this->fieldRepository = $fieldRepository;
|
|
$this->dropdownRepository = $dropdownRepository;
|
|
}
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
return view('admin::index');
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
return view('admin::create');
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
$inputData = $request->all();
|
|
try {
|
|
$this->fieldRepository->create($inputData);
|
|
toastr()->success('Field Created Succesfully');
|
|
} catch (\Throwable $th) {
|
|
toastr()->error($th->getMessage());
|
|
}
|
|
return redirect()->route('dropdown.index');
|
|
}
|
|
|
|
/**
|
|
* Show the specified resource.
|
|
*/
|
|
public function show($id)
|
|
{
|
|
return view('admin::show');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
return view('admin::edit');
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, $id): RedirectResponse
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|