84 lines
2.1 KiB
PHP
84 lines
2.1 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\DesignationRepository;
|
||
|
|
||
|
class DesignationController extends Controller
|
||
|
{
|
||
|
private $designationRepository;
|
||
|
|
||
|
public function __construct(DesignationRepository $designationRepository)
|
||
|
{
|
||
|
$this->designationRepository = $designationRepository;
|
||
|
}
|
||
|
/**
|
||
|
* Display a listing of the resource.
|
||
|
*/
|
||
|
public function index()
|
||
|
{
|
||
|
$data['title'] = 'Designation List';
|
||
|
$data['designationLists'] = $this->designationRepository->findAll();
|
||
|
return view('admin::designations.index', $data);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show the form for creating a new resource.
|
||
|
*/
|
||
|
public function create()
|
||
|
{
|
||
|
$data['title'] = 'Create Designation';
|
||
|
$data['editable'] = false;
|
||
|
return view('admin::designations.create', $data);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Store a newly created resource in storage.
|
||
|
*/
|
||
|
public function store(Request $request): RedirectResponse
|
||
|
{
|
||
|
$this->designationRepository->create($request->all());
|
||
|
return redirect()->route('designation.index');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show the specified resource.
|
||
|
*/
|
||
|
public function show($id)
|
||
|
{
|
||
|
return view('admin::designations.show');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show the form for editing the specified resource.
|
||
|
*/
|
||
|
public function edit($id)
|
||
|
{
|
||
|
$data['title'] = 'Edit Designation';
|
||
|
$data['editable'] = true;
|
||
|
$data['designation'] = $this->designationRepository->getDesignationById($id);
|
||
|
return view('admin::designations.edit', $data);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Update the specified resource in storage.
|
||
|
*/
|
||
|
public function update(Request $request, $id): RedirectResponse
|
||
|
{
|
||
|
$this->designationRepository->update($id, $request->all());
|
||
|
return redirect()->route('designation.index');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Remove the specified resource from storage.
|
||
|
*/
|
||
|
public function destroy($id)
|
||
|
{
|
||
|
//
|
||
|
}
|
||
|
}
|