84 lines
2.0 KiB
PHP
84 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\Admin\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Modules\Admin\Repositories\EthnicityRepository;
|
|
|
|
class EthnicityController extends Controller
|
|
{
|
|
private $ethnicityRepository;
|
|
|
|
public function __construct(EthnicityRepository $ethnicityRepository)
|
|
{
|
|
$this->ethnicityRepository = $ethnicityRepository;
|
|
}
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$data['title'] = 'Ethnicity List';
|
|
$data['ethnicityLists'] = $this->ethnicityRepository->findAll();
|
|
return view('admin::ethnicities.index', $data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
$data['title'] = 'Create Ethnicity';
|
|
$data['editable'] = false;
|
|
return view('admin::ethnicities.create', $data);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
$this->ethnicityRepository->create($request->all());
|
|
return redirect()->route('ethnicity.index');
|
|
}
|
|
|
|
/**
|
|
* Show the specified resource.
|
|
*/
|
|
public function show($id)
|
|
{
|
|
return view('admin::ethnicities.show');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
$data['title'] = 'Edit Ethnicity';
|
|
$data['editable'] = true;
|
|
$data['ethnicity'] = $this->ethnicityRepository->getEthnicityById($id);
|
|
return view('admin::ethnicities.edit', $data);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, $id): RedirectResponse
|
|
{
|
|
$this->ethnicityRepository->update($id, $request->all());
|
|
return redirect()->route('ethnicity.index');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|