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\GenderRepository;
|
|
|
|
class GenderController extends Controller
|
|
{
|
|
private $genderRepository;
|
|
|
|
public function __construct(GenderRepository $genderRepository)
|
|
{
|
|
$this->genderRepository = $genderRepository;
|
|
}
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$data['title'] = 'Gender List';
|
|
$data['genderLists'] = $this->genderRepository->findAll();
|
|
return view('admin::genders.index', $data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
$data['title'] = 'Create Gender';
|
|
$data['editable'] = false;
|
|
return view('admin::genders.create', $data);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
$this->genderRepository->create($request->all());
|
|
return redirect()->route('gender.index');
|
|
}
|
|
|
|
/**
|
|
* Show the specified resource.
|
|
*/
|
|
public function show($id)
|
|
{
|
|
return view('admin::genders.show');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
$data['title'] = 'Edit Gender';
|
|
$data['editable'] = true;
|
|
$data['gender'] = $this->genderRepository->getGenderById($id);
|
|
return view('admin::genders.edit', $data);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, $id): RedirectResponse
|
|
{
|
|
$this->genderRepository->update($id, $request->all());
|
|
return redirect()->route('gender.index');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|